JavaScript_Beginner_Notes
JavaScript_Beginner_Notes
Introduction to JavaScript
- What is JavaScript?
JavaScript is a programming language used to make web pages interactive. It runs in the browser and
HTML gives structure, CSS styles it, and JavaScript adds interactivity. You can embed JavaScript in HTML
- Where JS runs:
JavaScript mainly runs in web browsers, but it can also run on servers using environments like Node.js.
- Basic Syntax:
Example:
console.log("Hello, world!");
- Developer Tools:
Most browsers have Developer Tools (press F12) to see the Console, inspect HTML/CSS, and debug JS
code.
JavaScript Beginner Notes
- Variables:
Variables store data. You can use 'var', 'let', or 'const' to declare variables.
Example:
- Data Types:
- String: "Hello"
- Number: 42
- Basic operations:
Numbers: +, -, *, /
- Example:
console.log(greeting);
JavaScript Beginner Notes
- Comparison Operators:
== (equal), === (strict equal), != (not equal), !== (strict not equal), >, <, >=, <=
- Logical Operators:
- Conditional Statements:
Use if, else if, and else to run different code based on conditions.
- Example:
a minor.");
- Practical:
Create a script that checks if the user is old enough to access a site using prompt and alert.