0% found this document useful (0 votes)
10 views2 pages

JavaScript Basics Explained Simply

Uploaded by

sehan3061
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

JavaScript Basics Explained Simply

Uploaded by

sehan3061
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

New chat

javascript basis in small words

Here’s a simple overview of JavaScript basics:

1. Variables: Store data.


`let`, `const`, `var` (e.g., `let x = 10;`).
2. Data Types:
String (`"hello"`), Number (`42`), Boolean (`true`/`false`), Array (`[1, 2, 3]`), Object (`{
key: "value" }`).
3. Operators: Perform actions.
`+`(add), `-` (subtract), `*` (multiply), `/` (divide), `%` (remainder).
4. Functions: Reusable blocks of code.

javascript

function greet(name) {
return `Hello, ${name}!`;
}

5. Conditionals: Make decisions.

javascript

if (x > 10) {
[Link]("Big number");
} else {
[Link]("Small number");
}

6. Loops: Repeat actions.


`for`, `while`, `do...while`.

javascript

for (let i = 0; i < 5; i++) {


[Link](i);
}

7. DOM Manipulation: Interact with the webpage.

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 1/2
javascript

[Link]("myId").innerHTML = "Hello!";

8. Events: Respond to user actions.

javascript

[Link]("click", () => {
alert("Clicked!");
});

9. Objects: Store complex data.

javascript

const car = { brand: "Toyota", color: "red" };

10. ES6 Features: Modern syntax.


Arrow functions: `const sum = (a, b) => a + b;`
Template literals: `Hello, ${name}!`

Would you like examples or elaboration on any of these?

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 2/2

You might also like