Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

JavaScript_Beginner_Notes

JavaScript is a programming language that enhances web interactivity, running primarily in browsers and also on servers via Node.js. It involves using variables, data types, operators, and conditional statements to create dynamic content. Key concepts include embedding JavaScript in HTML, using Developer Tools for debugging, and performing basic operations with strings and numbers.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

JavaScript_Beginner_Notes

JavaScript is a programming language that enhances web interactivity, running primarily in browsers and also on servers via Node.js. It involves using variables, data types, operators, and conditional statements to create dynamic content. Key concepts include embedding JavaScript in HTML, using Developer Tools for debugging, and performing basic operations with strings and numbers.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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

allows you to create dynamic and responsive user interfaces.

- How JavaScript works with HTML and CSS:

HTML gives structure, CSS styles it, and JavaScript adds interactivity. You can embed JavaScript in HTML

using the <script> tag.

- Where JS runs:

JavaScript mainly runs in web browsers, but it can also run on servers using environments like Node.js.

- Basic Syntax:

Use 'console.log()' to print messages to the browser console.

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 and Data Types

- Variables:

Variables store data. You can use 'var', 'let', or 'const' to declare variables.

Example:

let name = "John";

const age = 25;

- Data Types:

- String: "Hello"

- Number: 42

- Boolean: true or false

- Null: empty value

- Undefined: declared but not assigned

- Basic operations:

Strings: concatenation with +, template literals with backticks (`)

Numbers: +, -, *, /

- Example:

let greeting = "Hello, " + name;

console.log(greeting);
JavaScript Beginner Notes

Operators and Conditions

- Comparison Operators:

== (equal), === (strict equal), != (not equal), !== (strict not equal), >, <, >=, <=

- Logical Operators:

&& (and), || (or), ! (not)

- Conditional Statements:

Use if, else if, and else to run different code based on conditions.

- Example:

let age = 18; if (age >= 18) {

console.log("You are an adult.");

} else { console.log("You are

a minor.");

- Practical:

Create a script that checks if the user is old enough to access a site using prompt and alert.

You might also like