Day 6 of #100daysofjs

Day 6 of #100daysofjs

Expression & Conditionals

A fragment of code that produces a value is called an expression.

Every value written is an expression for ex: 77 or "Arpan"

Operators in js

Arithmetic Operators

+ Addition

- Subtraction

* Multiplication

** Exponentiation

/ Division

% Modules

++ Increment

-- Decrement

Assignment operators

\= x=y

+= x= x+y

-= x=x-y

\ = x=x\y

/ = x= x/y

% = x= x%y

\= x = x**y

Comparison Operators

\== equal to

! = no equal

\=== equal value and type

!== not equal value or not equal type

\> greater value

< less than

\> = greater than or equal to

<= less than or equal to

? ternary operator

Logical operators

&& Logical and

|| Logical or

! Logical not

comments in js

Sometimes we want our programs to contain text which is not executed by the js Engine.

such a text is called comments in JavaScript

A comment in js can be written as follow:

//This is a single-line comment

/* */This is a multi-line comment

Sometimes comments are used to prevent the execution of some lines of codes

let switch = true;

// switch = false; COMMENT LINE WONT EXECUTE