Introduction to JavaScript

By Shakib Ansari | Date: Tue, Oct 7, 2025

1.1 What is JavaScript ?

JavaScript ek high level, dynamic, and interpreted programming language hai, jo web developement ke liye use hoti hai. JavaScript bas ek programming language hi nhi balki ye world wide web ka heart hai. Mostly websites JavaScript se hi bani hai chahe frontend ho ya backend. Website ke frontend ko build karne ke liye ham HTML, CSS, and JS (JavaScript) ka use karte hai aur backend ke liye Node.js (JavaScript ka runtime environment) along with other libraries like express.js.

1. 2 History of JavaScript ?

JavaScript ki history thodi complex aur interesting hai even JavaScript ka official name bhi JavaScript nhi hai.

JavaScript ko 1995 mein banya gya tha, iske creator hai Brendan Eich, ye ek company Netscape Communications mein programmer the. JavaScript ka initial purpose tha ki Netscape Navigator web browser ke HTML pages mein dynamism and interactivity jaise features ko add karna.

Early Development and Naming:

  • JavaScript ka initial name "Mocha" tha phir baad mein ise rename kar diya with "LiveScript"
  • In 1996, Netscape ne "LiveScript" ka naam change kar diya to "JavaScript" because of us time par Java language ki popularity bahut hi badh rahi thi. Although JavaScript aur Java mein koi direct relation nhi hai.

Standardization and Browser Wars:

  • Ab jab javaScript itni popular ho rahi thi to, Microsoft ne bhi apna ek version introduced kar diya called "JScript" for Internet Explorer, lekin isse web developers ko ek problem aayi ki wo website kis browser ke according banaye Netscape ke ya Internet Explorer ke ?
  • Is problem ko resolve karne ke liye Netscape ne JavaScript ko ECMA (European Computer Manufacturers Association) ko submit kar diya JavaScript ka standardization karne ke liye.
  • In 1997, ek ECMA-262 standard release hua jisko ECMAScript se jana jaata hai, isme js ko consistent aur sabhi browser ke liye compatable banaya.

Evolution and Modern Era:

  • JavaScript ke early version mein performance aur security issues the, lekin 2008 mein jab Google ne apna V8 engine banaya to isme performace significantly improve hui aur web applications mein security enhance hui.
  • Jab 2009 mein Node.js introduce hua to JavaScript ko developers server-side development ke liye bhi use karne lage.
  • ECMAScript continuously evolve hoti rahi with regular updates, including ES5(2009), ES6/ES2015, aur anually updates release hote hai, kuch new features bhi introduce hue hai like, classes, promises, arrow function and more.
  • Ab aaj ke time par JavaScript Web Development ke liye ek bahut hi powerful language ban gyi hai, kioki ise ham client-side (frontend) and server-side (backend) dono ke liye use kar sakte hai.

1. 3 Features of JavaScript

JavaScript ek versatile aur widely use hone wali programming language hai, jisme bahut saare key features hai jisse ye popular and best language bani for web development.

  1. Lightweight and Interpreted: JavaScript ek lightweight language hai aur ise compilation ki zarurat nhi hoti before execution. Web browsers code ko directly interpret karte hai, jisse development and testing fast hoti hai.
  2. Dynamically Typed: JavaScript ek dynamically typed language hai, jiska matlab hai ki variable's ke type ko runtime par determine karega na ki hame explicitly declare karna padega. Isse developers ko flexibility milti hai, kioki wo different types ki values ko same hi variable mein assign kar sakte hai during program execution.
  3. Event-Driven: JavaScript ek event-driven programming language hai, jiska matlab hai ki ye user interactions ke time par respond karti hai, like clicks mouse movements, or key presses. Isse developers highly interactive and responsive website's develop kar sakte hai.
  4. Multiple Programming Paradigm: JavaScript functional and object oriented dono paradigm ko support karti hai. JavaScript mein sab kuch object hota hai.
  5. Platform Independent: JavaScript ek platform independent programming language hai jiska matlab hai ki ye kisi bhi platform par run ho sakti hai jo ek browser ko support karta ho.
  6. DOM Manipulation: JavaScript ko frontend mein jab ham use karte hai to ham iske through DOM (Document Object Model) ko access karte hai, jo ki HTML and CSS ke content ko dynamically change karta hai.
  7. ES6+ Features (Modern JavaScript): JavaScript mein recently bahut sare new features introduce hue hai. let & const, Arrow Functions, Template Literals, Destructuring, Modules, Promises & async/await and Spread and Rest operators.
  8. JSON Support: JSON stands for JavaScript Object Notation, iska use API's mein aur data exchange ke liye use hota hai.
  9. Error Handling: JavaScript Error Handling ko bhi support karti hai using try...catch block, iska use runtime error ko handle karne ke liye use hota hai.
  10. Highly Extensible: JavaScript bahut hi extensible language hai isko ham HTML, CSS, databases and API's ke sath integrate kar sakte hai.

Note: JavaScript ke kuch features abhi aapko samjh naa aaye ho kioki kuch advanced features hai, lekin jab ham advanced features padhenge tab easilly samjh aa jayenge.

1. 4 How JavaScript Works (Client-side VS Server side)

JavaScript ek scripting language hai, jisko ham client (within web browser) and server (web server) side dono par run kar sakte hai.

  1. Client-Side: Ise directly web browser execute hai, on user's devices. Iska primarily use, user experience ko enhance karna ke liye hota hai. Ye web pages ko dynamic and interactive banata hai using DOM manipulation. Client-Side se server request bhi kar sakte hai like API call.
  2. Server-Side: Ye JavaScript ka runtime environment hota hai, jo as a web server kaam karta hai mostly Node.js use hota hai. Iske use web applications ke backend ko code karne ke liye use hota hai. Yahi server-side logic ko handle karta hai, database aur server ke other resources se interact karta hai.

1. 5 Setting up Your Development Environment:

JavaScript Development Environment ko setup karne ke liye hame 3 cheeze chahiye.

  1. A code editor (Code likhne ke liye)
  2. A browser (JS ko run karne ke liye)
  3. Node.js + npm (JS ko browser ke outside run karne ke liye)

Install a Code Editor (VS Code Recommended)

Visual Studio is most popular code editor, you can download it from here according to your machine

After installation, verify in terminal:

node -v
npm -v

Tumhe yaha version ka numbers show hoga.

Start Code in JS

Ab JavaScript ka environment setup ho gya ab ham iske two way's se run kar sakte hai.

  1. Browser: Is tareeke mein ham ek index.html and script.js file create karte hai aur index file mein script ko include karke live server (VS Code Extension) se index.html file ko run kar sakte hai aur script file ke code ka output browser mein show hoga.
  2. Terminal: Is tareeke mein ham ek JavaScript file create karte hai aur usi mein js ka code likhte hai and terminal ke through use run karte hai using
node script.js

Note: Ham abhi JavaScript ko browser se run nhi karenge, balki terminal se run karenge jisse hamari js understanding strong ho jaaye.

1.6 First JavaScript Program

Sabse pehle ek folder create karo, using cmd line mkdir "JS Programming" and then write cd "JS Programming". Ab ek folder create ho gya hai ab ek file create karo first.js and then start to write code.

JS Code:

console.log("Hello, World");

Run this file:

node first.js

Output:

Hello, World

Explanation: console.log() ek argument expect karta hai aur us value ko console (output screen) par show karta hai.

About the Author

Hi, I'm Shakib Ansari, Founder and CEO of BeyondMan. I'm a highly adaptive developer who quickly learns new programming languages and delivers innovative solutions with passion and precision.

Web-Development

Comments