You are on page 1of 2

JavaScirpt

------------------------------------------

console.log('Hello World');
2+2 => 4
alert('yo')
popup will come

For behaviour we need javascript

Node is Runtime environment to execute JS code


node index.js

Primitive/Value types
String,boolean,Number,Undefined,null

JS is Dynamic Language
-> Type of var can be changed in Runtime

we dont have floating point/integers


all are same here

Reference types-> object, array, function

Objects
under { }
and if we have to change the name of object (ex) we have 2 ways

1.dot notation
2.Bracket noation

Arrays
Object in the array as well as size in array is DYNAMIC in js.
it can be string also with numbers.

arr.length

Functions
with function keyword then () and {....body ....}

they eaither performs a task or either returns a value.

------------------------------------------------

Operators

Arithmetic operators->
+ - * / % ** double is xpow y then ++,-- increment decrement

Assignment operators-> x=x+5;

Comparison operator-> return boolean console.log(x>5); or (x==5)

Eqaulity Operators->
Strict equlity === String and no are not same '1' === 1 is false
loose equality == String and no are same '1' == 1 is true as value is exactly
same. this way true==1 is also true.
Stricly cheks for same type and same value

Ternary Operators
let points=110;
let type=points>100?'gold':'silver';

Logical Operators
&& ||
'!' this is used to convert true to false and vice versa.

//for non boolean also works here


console.log(true || 'shiv'); true
console.log(false || 'shiv'); shiv
console.log(true && 'mahisha'); manisha
console.log(false && 'mahisha'); false

//it is depending upon the first values to check next or not


//if done with first that result is this then not needed to check last

(false || 1 || 2) this will return 1 as false then op checks for next hope as true
and whaterver it will be will be the result

--------------------------------------

Bitwise oPerators
1|2=3 and 1&2=0

Operator Precedence
* > + > -

You might also like