Numbers as string can subtract , multiply , divide other Numbers and numbers as string (except Addition ) and return an integer value. Don't worry , it's a bug of JavaScript !!
2๏ธโฃ How 010 = 8 ?
It happens in JavaScript because every number containing a "0" in front of it is referred as an octal number . And as octal 10 = decimal 8 that's why it will return 8 !!
3๏ธโฃ Did you know that string function returns a string but "new String ()" returns an object !!
See below ๐
4๏ธโฃ If you convert "null" to a number it will return 0 . That's why 10 + 0 will be 10 !!
5๏ธโฃ {} === {} Will return false because "{}" is an object and object can never be equal another object as they have unique identifiers.
6๏ธโฃ Comma operator
"," is an operator that separates expressions and returns the last expression in the chain.๐
7๏ธโฃ IIFE :-
IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined.
8๏ธโฃ You can make a new scope by using "{}" (no need for a function or if-else statement ) . ๐
9๏ธโฃ If you want to measure the performance time of your Js program , than you need not use date/time . You can use performance.now() like this ๐
๐ In JavaScript , typeof null will return Object . But if you use null instanceof Object , this will return false !! That's because it's a big of JavaScript ๐
That's all guys for this thread !
If you find this thread useful then,
๐ Retweet the first tweet.
๐ Like all the tweets.
๐ Follow me (@Tony_Codezz ) and turn on my notifications.
Note:- Your support motivates me.
โข โข โข
Missing some Tweet in this thread? You can try to
force a refresh