Javascript Expression Evaluation

var t=y=u=9;
console.log(u); //will print 9

Except the (+) operator which is used for string concatenation and addition,all other operator converts the type to its equivalent value.

”2"-true will be 1

Adding Strings and Numbers

Adding a number and a string will always return a string:
Example
“5” + 5; //55
“Hello” + 5; //Hello5

Examples:

"3" - "1" = 2
"3" - 1 = 2
"3" * "2" = 6
"3" % "2" = 1
"3" + null = 3null

We know about Hoisting in JS,but there is a loophole in it.

Check this code:

var foo = function bar(){ return 12; };
var t=bar();

It will give you Reference error:bar is not defined.

This is because bar() is a function expression rather than a declaration.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store