1.
Core Concepts
• Client-Side Scripting: JavaScript runs on the user's browser, making pages dynamic without
server interaction.
• Scripts: A script is a list of commands executed to make web pages interactive.
• Embedding JavaScript in HTML: Add JavaScript inside ... tags in head or body sections.
2. Variables and Data Types
• Variables: A variable stores data. Declared using var keyword. Rules: must start with alphabet,
case-sensitive, no spaces, cannot use keywords.
• Example: var a; var x = 'Hello';
• Data Types:
• - Number: Stores integers/decimals. Example: var y = 10000;
• - String: Stores text in quotes. Example: var str = 'Hello';
• - Boolean: true or false.
• - null: Represents nothing/empty.
• - undefined: Declared but not assigned value.
• - Infinity: Result of division by zero. Example: 3/0 = Infinity.
3. Operators
• Arithmetic Operators: +, -, *, /, %. Example: 40+4.5=44.5
• Assignment Operator: = assigns values. Example: var p = 400;
• Relational Operators: <, >, ==, != compare values. Result is true/false.
• Logical Operators: && (AND), || (OR), ! (NOT).
• Increment/Decrement: ++, -- for increasing/decreasing values. Pre and Post examples.
4. Functions and Control Structures
• Functions: Reusable block of code defined with function keyword.
• Decision Making: if, if-else for conditional execution.
• Loops: for and while for repeated execution.
• Built-in Functions: alert(), prompt(), confirm(), parseInt(), parseFloat().