■ JavaScript Workshop Notes (For Juniors)
by: [Your Name]
1. What is JavaScript?
JavaScript (JS) is a programming language of the web. It makes websites interactive and
dynamic. HTML = Structure, CSS = Style, JavaScript = Behavior.
Example: Click Me!
2. How to Run JavaScript
Ways to run JS: Inside HTML script tag, External JS File, and Browser Console.
[Link]('Hello JS');
3. Variables
Variables store data values. Use let for changeable, const for fixed.
let name = 'Hafijur'; const pi = 3.14; var age = 20;
4. Data Types
Common types: String, Number, Boolean, Array, Object, Null, Undefined.
let student = { name: 'Aarav', age: 19, isPresent: true };
5. Operators
Arithmetic: + - * / % | Comparison: == === != < > | Logical: && || !
let a = 10, b = 5; [Link](a > b && a != 0);
6. Conditional Statements
Use if-else or switch for conditions.
if(age >= 18){ [Link]('Vote'); }else{ [Link]('No'); }
7. Loops
for, while, for-of used for repeating tasks.
for(let i=0;i<5;i++){ [Link](i); }
8. Functions
Reusable blocks of code.
function greet(name){ [Link]('Hello '+name); }
9. Arrays
Array stores multiple values.
let fruits = ['Apple','Mango']; [Link]('Banana');
10. Objects
Objects store data in key-value pairs.
let car = { brand: 'Tata', model: 'Nexon' };
11. DOM Manipulation
JS can change HTML using DOM.
[Link]('heading').innerText='Hello!';
12. Events
Add interactivity using events like onclick or addEventListener.
[Link]('btn').addEventListener('click',()=>alert('Clicked
'));
13. Timing Functions
Execute code after delay or repeatedly.
setTimeout(()=>[Link]('Hi'),2000);
14. Mini Projects
Try building Counter, Color Changer, To-do List, Light ON/OFF, etc.
15. Practice Questions
1. Print 1–10 using loop. 2. Function to square a number. 3. Array of fruits. 4. Object
student. 5. Button changes color.