JavaScript Fundamentals: A Complete Beginner's Guide (Part 1)
Learn JavaScript from scratch by understanding variables, data types, operators, type conversion, and writing your first programs with practical examples.

JavaScript is one of the most influential programming languages in the world. Every modern website you interact with uses JavaScript to create dynamic, interactive, and engaging user experiences. Whether you're clicking a button, submitting a form, watching animations, or chatting with an AI assistant, JavaScript is working behind the scenes.
Originally created in just ten days by Brendan Eich in 1995, JavaScript started as a lightweight scripting language for web browsers. Over the years, it evolved into a full-fledged programming language capable of running servers, desktop applications, mobile apps, games, IoT devices, and even artificial intelligence applications.
Today JavaScript is the only language that runs natively inside every modern web browser. Combined with technologies like HTML and CSS, it forms the foundation of web development.
In this article we'll learn the core building blocks of JavaScript. You'll understand variables, data types, operators, expressions, type conversion, and write several programs that will strengthen your programming fundamentals.
By the end of this article, you'll have enough knowledge to begin solving programming problems and building small JavaScript applications.
console.log("Hello World!");
console.log("Welcome to JavaScript!");let name = "Puneet"; let age = 21; console.log(name); console.log(age);
const PI = 3.14159; const country = "India"; console.log(PI); console.log(country);
var city = "Delhi"; let state = "Uttar Pradesh"; const language = "JavaScript"; city = "Mumbai"; state = "Bihar"; // language = "Python"; // Error console.log(city); console.log(state); console.log(language);
Understanding Variables
Variables are containers that store data inside a program. Every application stores information such as usernames, passwords, scores, products, prices, and much more using variables.
JavaScript provides three ways to declare variables: var, let, and const. Modern JavaScript recommends using let and const because they provide block scope and reduce unexpected bugs.
Use let when the value needs to change during execution. Use const when the value should remain constant throughout the program.
JavaScript Data Types
Everything in JavaScript is treated as data. Understanding data types helps developers write predictable and bug-free applications.
JavaScript has two categories of data types: Primitive and Non-Primitive.
let age = 20; let salary = 55000.50; console.log(age); console.log(salary);
let firstName = "Puneet"; let lastName = "Tiwari"; console.log(firstName + " " + lastName);
let isStudent = true; let hasJob = false; console.log(isStudent); console.log(hasJob);
let marks; console.log(marks);
let user = null; console.log(user);
let population = 12345678901234567890n; console.log(population);
const id1 = Symbol("id");
const id2 = Symbol("id");
console.log(id1 === id2);Primitive values are immutable. Whenever you modify them, JavaScript creates a completely new value instead of changing the original one.
Objects, arrays and functions belong to the non-primitive category. These are mutable and stored differently in memory.
Understanding the difference between primitive and reference types becomes extremely important while working with React, Node.js and modern JavaScript frameworks.
const student = {
name: "Puneet",
college: "NIAMT",
year: 3
};
console.log(student);const languages = [ "JavaScript", "Python", "C++", "Java" ]; console.log(languages);
console.log(typeof 100);
console.log(typeof "Hello");
console.log(typeof true);
console.log(typeof {});
console.log(typeof []);
console.log(typeof null);Summary
Congratulations! You have learned the foundations of JavaScript including variables, modern variable declarations, primitive data types, reference data types, objects, arrays, and the typeof operator. These concepts are the building blocks for everything you'll learn next, from functions and loops to React and Node.js.
Puneet Tiwari
Full Stack Developer
