Pritam Pramanik Profile picture
πŸ”¬ Physics and math enthusiast, always seeking to unravel the mysteries of the universeπŸš€When I'm not crunching numbers, I'm coding up a stormπŸ§ͺ

Sep 1, 2021, 12 tweets

πŸ’› 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.

Keep scrolling