0% found this document useful (0 votes)
15 views

Javascript Practice

This document discusses different JavaScript operators like arithmetic, assignment, logical, and comparison operators. It also covers conditional statements like if/else and ternary operator. Loops like for and while are demonstrated along with taking user input using prompt.

Uploaded by

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

Javascript Practice

This document discusses different JavaScript operators like arithmetic, assignment, logical, and comparison operators. It also covers conditional statements like if/else and ternary operator. Loops like for and while are demonstrated along with taking user input using prompt.

Uploaded by

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

//artimetic opretors

// let a =5;
// let b =2;

// console.log("a + b =", a+b);


// console.log("a - b =",a - b);
// console.log("a * b =",a * b);
// console.log("a / b =",a / b);
// console.log("a % b =",a % b);
// console.log("a ** b =",a ** b);

//unaru oprator
// let a =5;
// let b =2;

// console.log("a=",a, " & b =",b );


// ++a;//6
// console.log("a = ",a);

//assingment operator
// let a = 6;
// let b = 5;
// logical AND
/*let cond1 = a < b;
let cond2 = a===6;
console.log ("cond1 && cond2 =", a < b && a ===6);*/

//logocal OR
//console.log ("cond1 || cond2 =", a < b || a ===6);

//logical NOT
//console.log ("! (6<5) =", !(a < b));

//conditional statements
// if
// let age = 18;

// if(age>18) {
// console.log("you can vote");
// }
// else {
// console.log ("you can't vote");
// }

// let age = 20;

// let result = age>=18 ?"adult" : "not adult";


// console.log (result);

// alert("hello");
// prompt to take a input
// let name = prompt("name");
// console.log ("username is", name );

// let num = prompt("enter a number");


// // multiple of 3 questionb
// if(num %3 ===0) {
// console.log(num, "is multiple of 3");
// } else {
// console.log(num, "is not a multiple of 3");

// }

// for (let count = 1; count <=10000; count++){


// console.log("aadijain");
// }console.log("loop has ended");

// let sum =0;


// let n = prompt("enter a num");

// for(let i =1; i<= n; i++){


// sum =sum +i;
// }
// console.log("sum =", sum);
// console.log("loop has ended");

//while loop

You might also like