JavaScript Fundamentals
Introduction to JavaScript
Introduction to JavaScript
Section titled “Introduction to JavaScript”JavaScript is the programming language of the web, enabling interactive and dynamic websites.
Why Learn JavaScript?
Section titled “Why Learn JavaScript?”- Universal - Runs in every web browser
- Full-Stack - Frontend, backend (Node.js), mobile, desktop
- Large Ecosystem - npm has over 2 million packages
- High Demand - One of the most sought-after skills
Your First JavaScript
Section titled “Your First JavaScript”// In the browser console or a .js fileconsole.log("Hello, World!");
// Variableslet name = "Alice";const age = 25;
// Functionfunction greet(person) { return `Hello, ${person}!`;}
console.log(greet(name)); // Hello, Alice!Running JavaScript
Section titled “Running JavaScript”In the Browser
Section titled “In the Browser”- Open DevTools (F12)
- Go to Console tab
- Type JavaScript and press Enter
With Node.js
Section titled “With Node.js”# Install from nodejs.orgnode --version
# Run a filenode script.js
# Interactive modenode