Beginner to Pro: JavaScript Explained in Desi Style
Hi! My name is Safia Khatoon. I am complete my Bachelors in Technology from RTC Institute Of Technology. My specialisation in Computer Science and Engineering.I love contributing to Open Source with the help of the skills I gain.
Also, I'm working on my YouTube Channel as well where I teach about DevOps tools and make technical content. You can have a look at it through my profile.
Feel free to reach out to me! I'd be happy to connect with you.
JavaScript is the heart of modern web development. But most learners struggle with understanding how it actually works. In this blog, we’ll break down the tricky parts in a fun and easy way. So grab your chai ☕ and let’s dive into the world of JavaScript.
What is JavaScript?
JavaScript is a programming language that makes web pages interactive and runs in the browser.
Why we use Javascript ?
because HTML is boring, and in JavaScript, HTML comes to life—like adding flavor to biryani.
How do we use JavaScript?
in browser :
Go to the browser —> inspect —> console

Code editor (like VS Code…)
Download and use it.
It is a free and popular code editor by Microsoft.

Our 1st JS Code :

Most people wonder whether to use a semicolon or not.
It's a good practice to use semicolons (;), but if you don't, your code will still run.
Our 2nd JS Code :
First, go to VS Code, then create two files: index.html and index.js.
and just add your js file to html:
<script src="index.js"></script>

Go to index.js :

live server —> inspect —> console

Variables in JS :
it's like a box where you put any type of data, for example, number, string, boolean, bigInt, null, undefined, etc.



What is the difference between null and undefined?
🔸 undefined: "I was created, but no one told me what my job is!" 😵
🔸 null: "I'm saying it myself — I have nothing!" 😌
|
|
Note :
JS is a dynamically typed programming language.
Dynamically typed means no need to worry about declaring data types.
JS is a case-sensitive language, which means there is a difference between upper and lower case.
variable rules :
Variable names are case sensitive; “a” and “A” are different.
Only letters, digits, underscores (_), and $ are allowed (not even spaces).
Only a letter, underscore, or $ should be the first character.
Reserved words cannot be variable names.
let const & var :
🔹 var:
"I'm the old uncle... I can go anywhere without permission (both global and local)" 😅
🔹 let:
"I'm a modern guy, I follow the rules — I don't go outside the block{}!" 🤓
🔹 const:
"I'm a stubborn person, once I set a value... I will never change it!" 😤
| Feature | var | let | const |
| Scope | Function Scope | Block Scope | Block Scope |
| Redeclare? | Yes | ❌ No | ❌ No |
| Reassign? | ✅ Yes | ✅ Yes | ❌ No |
| Hoisted? | ✅ Yes (undefined) | ✅ Yes (but TDZ*) | ✅ Yes (but TDZ*) |
TDZ = Temporal Dead Zone = Can't access before declared
Hoisted means :
🪜 JavaScript says: "I lift the declared variable or function to the top (before the code runs), but I don't take the value!" 😅




let :






const :




Data types in JS :
🔹 1. String → "Safia"
✨ "This is how JS speaks — it treats everything written as text!" 💬
🔹 2. Number → 99, 3.14
🧮 "This is the math expert — counting, grades, it's all here!" 📊
🔹 3. Boolean → true, false
✅❌ "This is JS's yes/no machine — will there be a wedding or not?" 😆
🔹 4. Undefined → let a;
🤷♂️ "Made it but didn't tell what to do with it?" 😅
🔹 5. Null → let x = null;
🫥 "It's saying itself — 'I'm empty, I have zero value, buddy!'" 😌
🔹 6. Object → {name: "Safia", age: 21}
🧳 "This is JS's suitcase — it has both the name and the stuff!" 🎒
🔹 7. Array → [1, 2, 3]
📦 "A box with more than one thing — a complete thepla combo pack!" 🍱
🔹 8. Symbol → Symbol("id")
🆔 "JS's secret code — unique everywhere, no copies!" 🔒
🔹 9. BigInt → 12345678901234567890n
💸 "This is JS's Ambani — it doesn't like small numbers!" 🤑
Table :
| Data Type | Example | Description |
| String | "hello" | Textual data |
| Number | 42, 3.14 | Numeric values |
| Boolean | true, false | Yes/No, On/Off |
| Undefined | let x; | Declared but not assigned |
| Null | let x = null; | Empty intentionally |
| Object | {name: "Ali"} | Key-value collection |
| Array | [1, 2, 3] | Ordered list |
| Symbol | Symbol("id") | Unique value |
| BigInt | 1234567890123n | Large integers beyond safe limit |


Object: (In an object const, you can change a particular value)




Operators and Conditional Statements :
Comments in JS :

Arithmetic Operators & Unary Operators :
Assignment Operators**+, - , , / , **,%,++,- -**


Assignment Operators :
\= , +=, -=, \= , /= , %=, **= ,


Comparison Operators :


Logical Operators :


Ternary Operators :


Conditional Statements (if) :


if-else Statement :


else-if Statement :


MDN docs:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
prac :




Loops and Strings :
Loops are used to execute a piece of code again and again.
for loop :




infinite loop :
so these types of loops are never used because they do not end.
while loop :


do while loop :


for of loop :


for-in loop :






STRINGS :
A string is a sequence of characters used to represent text.






Practice :

