#ααα«α_α¨αα_αα
If you don't understand this code α α°αα₯ αα #αα_lol
let fasting = false;
const startDate = new Date();
startDate.setHours(0, 0, 0, 0); //(12:00 AM)
const endDate = new Date("2025-04-20T03:00:00");
const durationInMilliseconds = endDate - startDate;
fasting = true;
console.log("αα/fasting started.");
// setTimeout to handle the end of the fasting period
setTimeout(() => {
fasting = false; // Set fasting to false after 55 days
console.log("α΅ααα α© α²α α¨αα³α α°αααΆ α°αα΅α·α"); // Log the message
console.log("αα/fasting ended.");
}, durationInMilliseconds);
const obj1 = { id: 1 };
const obj2 = { id: 1 };
const obj3 = obj1;
console.log(obj1 === obj2);
console.log(obj1 === obj3);
What is the output of the above code
Anonymous Quiz
26%
false true
11%
true false
46%
true true
13%
false false
4%
error
Forwarded from αα₯αα½
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
Been off latelyβ¦ had to train my finger to hit Tab professionally ποΈββοΈβ¨οΈ
#coding_meme@forcoder #codingmeme
#coding_meme@forcoder #codingmeme
for-coder
What is the output of the above code
Please open Telegram to view this post
VIEW IN TELEGRAM
Open your console and type:
typeof null
You'll get:
'object'
That's wrongβnull is not an object!
π How did this happen?
When JavaScript was first implemented, values were stored in a tagged format, where the lower bits determined the type:
-
Objects
had a type tag of 0. -
null
was stored as 0
in memory. Since
null
had 0
in its type tag, typeof
mistakenly classified it as an "object". π§ Why isn't it fixed?
One word: Backward compatibility.
Fixing it would break too many apps, so it's here to stay!
π¬ Share this with JavaScript haters
new
#JavaScript #Bug #Programming