Hackforge Academy

Category: javascript

Variables

Published on 29 Jun 2026

Explanation

Variables store values in JavaScript. The keywords var, let, and const are used to declare variables.

Code:

let name = 'John';
const age = 25;

Explanation

JavaScript supports primitive data types such as String, Number, Boolean, Undefined, and Null.

Code:

let city = 'Chennai';
let score = 95;
let active = true;

Explanation

The typeof operator returns the data type of a variable.

Code:

console.log(typeof 'Hello');
console.log(typeof 100);

Explanation

Objects and Arrays are non-primitive data types used to store collections of data.

Code:

const student = { name: 'John', age: 22 };
const skills = ['HTML', 'CSS'];

Explanation

Variables declared with let can be reassigned, while const variables cannot.

Code:

let count = 1;
count = 2;

const country = 'India';

๐Ÿš€ Learn Spring Boot with real-world projects

๐Ÿ’ก Build REST APIs step by step

๐Ÿง  Improve backend development skills

๐ŸŽฏ Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

๐Ÿ

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
โš›๏ธ

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community
โ˜•

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community