JS Fundamentals 6 min readLesson 2 of 2
JS Variables & Data Types
Learn let, const, var, string, number, boolean, array, and object data types.
### Declaring JavaScript Variables
- const — Used for variables that will not be reassigned.
- let — Used for variables that can change.
- var — Legacy scope keyword (prefer let/const in modern JS).
javascript
const siteName = "TheCodeBrains"; let score = 100;
const user = {
name: "Priya",
role: "Developer"
};
`
Interactive Sandbox
JS Objects & Arrays Demo
Live W3-EditorEdit code below and see instant live output in the preview box
Source Code InputHTML / CSS / JS
Live Browser Result Live Result
Test Yourself With Exercises
Verify your understanding before moving to the next topic
Which keyword declares a block-scoped constant variable in JavaScript?
❮ Previous: JavaScript Introduction
Course Completed! 🎉