When I started learning JavaScript, I didn't build websites firstโI practiced in the console. It's the easiest way to understand how JavaScript works.
What is console.log()?
console.log() prints output to the browser console.
console.log("Hello, World!");
Output:
Hello, World!
Variables in the Console
let name = "Narasimma";
let age = 21;
console.log(name);
console.log(age);
Simple Addition
let a = 10;
let b = 20;
console.log(a + b);
Output:
30
Create a Function
function greet(name) {
return "Welcome " + name;
}
console.log(greet("Student"));
Output:
Welcome Student
Where Do You Practice?
Open Google Chrome
Press F12
Select Console
Type your JavaScript code and press Enter
Conclusion
The console is the best playground for beginners. Practice with variables, operators, functions, and console.log() before moving to DOM manipulation.
Start small. Code daily. Improve consistently. ๐
Top comments (2)
Great guide for beginners! When I was building my real-time Vanilla JS Text Analyzer, testing the string manipulation logic in the console first saved me hours of debugging. Do you still rely heavily on the console for testing complex logic, or do you prefer using built-in browser debuggers now?
Thanks! ๐ I still use the console a lot, especially when I'm learning a new concept or testing small pieces of logic like strings, arrays, and functions. For larger projects, I combine console.log() with the browser's Debugger to trace bugs more efficiently. Both tools have their place!