JavaScript - Explicit Type Coercion

preview_player
Показать описание

Hey guys, in this video we will learn about Explicit Type Coercion in JavaScript.

Practice Problems:
================
Try to answer the following questions without executing the code in codepen. Post your answers in the comment section below. Also, try to explain why do you think your answer is correct. Best of Luck!!

Q.
What will be printed in the console?
String(123)
String(-12.3)
String(null)
String(undefined)
String(true)
String(false)

Boolean('')
Boolean('Hello')
Boolean(0)
Boolean(200)
Boolean(-0)
Boolean(-200)
Boolean(NaN)
Boolean(null)
Boolean(undefined)
Boolean(false)

Number(null)
Number(undefined)
Number(true)
Number(false)
Number(" 12 ")
Number("-12.34")
Number("\n")
Number(" 12s ")
Number(123)

My Twitter Handle: @qaifikhan
Рекомендации по теме
join shbcf.ru