banner

Lecture 1: Intro to JavaScript, Variables, Data Types & Operators| Full Stack Free Course

Learn JavaScript basics by understanding variables, data types, operators, and program logic. This article covers essential concepts needed to build interactive web pages and create a strong foundation for modern web development.
authorImageVarun Saharawat17 Jun, 2026
Lecture 1: Intro to JavaScript, Variables, Data Types & Operators| Full Stack Free Course

JavaScript is the foundation of interactive web experiences, transforming static pages into dynamic applications. Before moving to advanced frameworks and development concepts, understanding JavaScript Basics is essential. 

This article explains core programming building blocks, including variables, data types, operators, and how JavaScript organizes application logic for modern web development.

What are JavaScript Basics?

JavaScript is a dynamic and versatile programming language that is designed to add interaction and dynamic behaviours to web platforms. Born in 1995 at Netscape under Brendan Eich, it has evolved from a basic form-processing tool into a vital cross-platform engine that drives modern applications.

To prevent incompatible rendering logic between web engines, JavaScript follows the standard rules specified by ECMA International. The biggest rewrite in recent history was ECMAScript 6 (ES6), which brought with it massive performance improvements and cleaner functional keywords.

In JavaScript , the data is dynamically typed . Other languages require you to label the type of data strictly before you run the code . It is able to evaluate categories on the fly, so developers can work with operations without having to declare data structures explicitly first.

How to Set Up a Local Coding Environment for JavaScript Basics?

Browsers contain internal execution engines that process code directly inside the developer console. To build systems outside a browser tab, a local environment needs a dedicated standalone runner tool.

Follow these general operational steps to configure a working environment:

  1. Install Node.js: Download the installer from the official engine repository based on your platform's operational layout. This supplies an external system engine to run script tasks.

  2. Verify Setup: Open your terminal or terminal application and input node --version to verify the execution runtime operates correctly.

  3. Configure an Editor: Open a text editor like Visual Studio Code, build a project folder, and create a file using a .js extension (for example, index.js).

  4. Run Script Files: Use the execution trigger path node index.js inside your active project window to run the script.

Also Read: What is syntax in programming

How to Learn JavaScript Basics Variables and Storage?

Variables are named containers for data. They associate memory locations with particular values. They give descriptive reference identifiers so that systems can store, fetch, and overwrite parameters during execution.

The Evolution of Variable Keywords

Modern syntax offers three declaration options. Every choice modifies the way values interact with structural code blocks.

  • var: The historical keyword configuration. It allows full redeclaration and value updates within the scope. It returns an undefined placeholder if referenced before definition.

  • let: Introduced in ES6 to restrict unexpected value overrides. It allows data re-assignment but blocks redeclaration inside the same structural scope.

  • const: Reserved for locked properties that must remain unchanged. It requires an initial value and blocks subsequent alterations or reassignments.

The very basic rule structure of variable assignment defines very specific behavioural outcomes depending on which declaration mechanism is used. Here is a comparison :

Keyword Option

Can Be Updated?

Can Be Redeclared?

Must Include Initial Value?

var

Yes

Yes

No

let

Yes

No

No

const

No

No

Yes

Data Types in JavaScript Basics

Data types define the nature of values stored inside an active system. JavaScript separates these elements into simple primitive categories and more complex non-primitive structural arrays.

Exploring Primitive Types

Primitive classifications represent single, unaltered values that transfer exact structural parameters during modification tasks.

  • Number: Processes integers and floating-point fractional numbers seamlessly.

  • String: Manages alphanumeric text configurations bound within single or double quotation markers.

  • Boolean: A binary logic marker evaluating exclusively to true or false.

  • Undefined: A placeholder for declared variables that have not yet been assigned a specific value.

  • Null: An intentional, explicitly assigned marker representing an empty space or no value.

  • BigInt: An extended numeric type used for massive numbers that exceed standard integer capacity.

The keyword typeof helps verify structural value types by evaluating variables during execution, as shown in the examples below:

JavaScript Basics Operators for Logic and Math

Operators are functional mathematical symbols used to alter values, calculate conditions, and manage complex programmatic comparisons.

Arithmetic and Comparison Functions

Arithmetic symbols handle standard mathematical operations like addition (+), subtraction (-), multiplication (*), and division (/). The modulus symbol (%) returns the remainder after full division steps.

Comparison mechanisms evaluate relationships between operands and return a definitive Boolean result. For instance, operators like greater than (>) and less than (<) check numeric value hierarchies.

Deep Dive into Value Matching

A common point of confusion for beginners is the specific distinction between standard structural equality and strict constraint validation.

  • Double Equality (==): Matches basic face value after running implicit type conversion behind the scenes.

  • Triple Equality (===): Validates both the face value and the exact underlying data category without conversion fluff.

Logical, Unary, and Conditional Evaluation

Logical operations combine multiple test constraints into unified decisions. The logical AND (&&) operator demands that all sub-conditions evaluate to true, while the logical OR (||) operator requires only a single matching true statement.

Unary variations operate on a single target property. For example, incrementors (++) and decrementors (--) adjust numeric properties by a single unit.

The ternary operator serves as a compact alternative to full block statements. It evaluates an expression and returns a specific result based on whether the condition is true or false:

FAQs

What is the exact functional difference between undefined and null?

undefined means a variable has been created but has not yet been given a value. null is a deliberate value assigned to a variable to show that it is empty.

Why does adding a number to a text string result in combined text?

JavaScript converts numbers into text characters automatically when you use the plus symbol next to a text string. This process is called implicit type coercion.

When should I use const instead of let for variables?

Use const for values that should never change while your program is running. Use let only when you know a value will need to be updated or overwritten later.
Popup Close ImagePopup Open Image
Talk to a counsellorHave doubts? Our support team will be happy to assist you!
Popup Image
avatar

Get Free Counselling Today

and Clear up all your Doubts

Talk to Our Counsellor just by filling out the form.
Student Name
Phone Number
IN
+91
OTP
Email Id
Join 15 Million students on the app today!
Point IconLive & recorded classes available at ease
Point IconDashboard for progress tracking
Point IconLakhs of practice questions
Download ButtonDownload Button
Banner Image
Banner Image