Professional Documents
Culture Documents
Java Scirpt
Java Scirpt
------------------------------------------
console.log('Hello World');
2+2 => 4
alert('yo')
popup will come
Primitive/Value types
String,boolean,Number,Undefined,null
JS is Dynamic Language
-> Type of var can be changed in Runtime
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 ....}
------------------------------------------------
Operators
Arithmetic operators->
+ - * / % ** double is xpow y then ++,-- increment decrement
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.
(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
* > + > -