π 10 JavaScript Unknown Facts that every developer must know . I bet you don't know many of them π
A Thread 𧡠π
#100DaysOfCode #Javascript #Coding #code #programming #CodeNewBie #DEVcommunity
1οΈβ£ Check this code below π
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.
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.