Learn coding with amol

Hello my name is amol sharma or vineet and this is my third part of learn coding with amol and in this part we are going to learn js(javascript)


 Hello my name is amol sharma or vineet and this is my third part of learn coding with amol and in this part we are going to learn javascript (js).

Part-3 javascript (js)


🧠 Complete JavaScript Guide

This guide covers the most important JavaScript concepts with examples and copy code buttons.

1. Variables

Used to store data values using let, const, or var.

let name = "Amol";

const age = 13;

var city = "Delhi";

2. Functions

Reusable blocks of code that perform a task.

function greet() {

  alert("Hello, Amol!");

}

greet();

3. if / else Conditions

Used to make decisions in code.

let score = 90;

if (score >= 50) {

  console.log("Passed!");

} else {

  console.log("Try again.");

}

4. Loops

Used to repeat a block of code.

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

  console.log("Count: " + i);

}

5. Arrays

A list of values stored in one variable.

let fruits = ["apple", "banana", "cherry"];

console.log(fruits[1]); // banana

6. Objects

Store data in key–value pairs.

let user = {

  name: "Amol",

  age: 13,

  city: "Delhi"

};

console.log(user.name);

7. DOM Manipulation

Used to change HTML content with JavaScript.

document.getElementById("myText").innerHTML = "Updated by JS!";

8. Events

JS can respond to user actions like clicks.

document.getElementById("myBtn").onclick = function() {

  alert("Button clicked!");

};

9. Math Operations

JavaScript supports basic math functions.

let x = 5 + 3;

let y = 10 - 2;

let z = 4 * 2;

console.log(x, y, z);

10. alert, prompt & confirm

Used for user input and messages.

alert("Hello!");

let name = prompt("What is your name?");

let sure = confirm("Are you sure?");
Report a Bug

🐞 Report a Bug

OR

Comments

Popular posts from this blog

Learn coding with amol

Learn coding with amol

Learn coding with amol