JavaScript Fundamentals Guide
๐ Table of Contents
- Developer Console
- Data Types
- Variables (var)
- Common Functions
- Live Code Playground
- Interactive Quiz
- Key Takeaways
- Related Articles
1. JavaScript Developer Console
The Developer Console allows you to run JavaScript directly in your browser for testing and debugging.
๐ Learn More
Use it to test code instantly without creating files.
๐ป Code Example
console.log("Hello, World!");
๐ฅ CLI Output
> Hello, World!
2. JavaScript Data Types
Primitive data types are the building blocks of JavaScript.
๐ View Data Types
- String: "Hello"
- Number: 42
- Boolean: true / false
- Undefined: let x;
- Null: let y = null;
๐ป Code Example
var text = "Hello";
var num = 10;
var isTrue = true;
๐ฅ CLI Output
> Hello
> 10
> true
3. Variables using var
The var keyword declares variables but has hoisting behavior.
๐ Hoisting Explained
Variables declared with var are moved to the top and initialized as undefined.
๐ป Code Example
console.log(name);
var name = "Bob";
๐ฅ CLI Output
> undefined
4. Common JavaScript Functions
๐ console.log()
Used for debugging.
console.log("Hello!");
๐ alert()
Displays popup messages.
alert("Welcome!");
๐ prompt()
Takes user input.
var user = prompt("Enter name");
๐ฅ CLI Output
> Hello!
> Welcome!
> User Input
๐งช Live Code Playground
Try JavaScript directly below:
๐ง Interactive Quiz
1. What is the output of console.log(typeof null)?
2. Which keyword has block scope?
๐ก Key Takeaways
- Console helps test code quickly
- Primitive types are core building blocks
- var has hoisting behavior
- Functions help debugging and interaction