Variables and types

const, let, the basic types, and why === matters.

Use const by default and let when the value must change. Avoid the older var.

Expected output
Kavin is 21
string number boolean

Always compare with ===

== converts types first, which gives surprising results. === compares both type and value.

Expected output
true
false
43
421
โ† Getting started with JavaScriptFunctions โ†’