What does console.log(0.1 + 0.2 === 0.3) print in JavaScript?
A
true
B
NaN
C
false
Correct answer
D
undefined
15 views
⚔️
Challenge a friend on Javascript
Same MCQs, timed, live leaderboard. Send the link on WhatsApp – no sign-up needed.
Create challenge
Explanation
JavaScript numbers are IEEE 754 binary floating-point values, and 0.1 + 0.2 equals 0.30000000000000004. Compare with a small tolerance, such as Number.EPSILON, instead.
Reference
Asked in: Frontend Developer Tests, Technical Interviews
Doubts & discussionNot sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ
‹ Previous MCQ Which JavaScript operator compares both value and type, without type conversion? Next MCQ › Which array method returns a new array containing the result of calling a function on every element?