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

JS2 ClassNotes

The document provides an overview of JavaScript operators, including arithmetic, assignment, comparison, logical, and ternary operators. It also covers conditional statements such as if, if-else, and else-if. Additionally, there are practice questions for users to implement input checks and grading based on scores.
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)
7 views

JS2 ClassNotes

The document provides an overview of JavaScript operators, including arithmetic, assignment, comparison, logical, and ternary operators. It also covers conditional statements such as if, if-else, and else-if. Additionally, there are practice questions for users to implement input checks and grading based on scores.
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
You are on page 1/ 12

Comments in JS

Part of Code which is not executed


Operators in JS
Used to perform some operation on data

Arithmetic Operators

+, -, *, /
Modulus

Exponentiation

Increment

Decrement
Operators in JS
Assignment Operators

= += -= *= %= **=
Operators in JS
Comparison Operators

Equal to == Equal to & type ===


Not equal to != Not equal to & type !==

>, >=, <, <=


Operators in JS
Logical Operators

Logical AND &&

Logical OR ||

Logical NOT !
Conditional Statements
To implement some condition in the code

if Statement
Conditional Statements
if-else Statement
Conditional Statements
else-if Statement
Operators in JS
Ternary Operators

condition ? true output : false output


MDN Docs
Let‘s Practice
Qs1. Get user to input a number using prompt(“Enter a number:”). Check if the number is
a multiple of 5 or not.
Let‘s Practice
Qs2. Write a code which can give grades to students according to their scores:
80-100, A
70-89, B
60-69, C
50-59, D
0-49, F

You might also like