[{"data":1,"prerenderedAt":1119},["ShallowReactive",2],{"blog-\u002Fblog\u002Fjavascript-data-types-type-coercion":3},{"id":4,"title":5,"body":6,"description":1103,"difficulty":1104,"extension":1105,"framework":1106,"frameworkSlug":1107,"meta":1108,"navigation":1109,"order":94,"path":1110,"qaPath":1111,"seo":1112,"stem":1113,"subtopic":1114,"topic":1115,"topicSlug":1116,"updated":1117,"__hash__":1118},"blog\u002Fblog\u002Fjavascript-data-types-type-coercion.md","JavaScript Data Types & Type Coercion — The Complete Guide",{"type":7,"value":8,"toc":1092},"minimark",[9,14,27,31,66,181,216,220,229,304,314,318,335,417,471,475,502,570,618,622,629,675,700,743,775,815,832,836,839,903,945,949,1008,1038,1042,1088],[10,11,13],"h2",{"id":12},"javascript-data-types-and-type-coercion","JavaScript data types and type coercion",[15,16,17,18,22,23,26],"p",{},"JavaScript's type system is small but full of sharp edges: seven primitives, one\nobject type, and a coercion engine that quietly converts values between types. That\ncoercion powers the \"wat\" examples (",[19,20,21],"code",{},"[] == ![]",", ",[19,24,25],{},"0.1 + 0.2 !== 0.3",") and a surprising\nshare of real bugs. This guide covers the types, equality, coercion rules, truthiness,\nand the gotchas worth knowing cold.",[10,28,30],{"id":29},"the-types","The types",[15,32,33,34,38,39,22,42,22,45,22,48,51,52,22,55,22,58,61,62,65],{},"There are ",[35,36,37],"strong",{},"seven primitive types"," — ",[19,40,41],{},"string",[19,43,44],{},"number",[19,46,47],{},"boolean",[19,49,50],{},"null",",\n",[19,53,54],{},"undefined",[19,56,57],{},"symbol",[19,59,60],{},"bigint"," — and everything else is an ",[35,63,64],{},"object"," (including\narrays and functions).",[67,68,73],"pre",{"className":69,"code":70,"language":71,"meta":72,"style":72},"language-js shiki shiki-themes github-light github-dark","typeof 'hi'      \u002F\u002F 'string'\ntypeof 42        \u002F\u002F 'number'\ntypeof 10n       \u002F\u002F 'bigint'\ntypeof Symbol()  \u002F\u002F 'symbol'\ntypeof undefined \u002F\u002F 'undefined'\ntypeof null      \u002F\u002F 'object'  \u003C- historical bug; null is a primitive\ntypeof []        \u002F\u002F 'object'  \u003C- arrays aren't singled out\ntypeof function(){} \u002F\u002F 'function'  \u003C- functions are\n","js","",[19,74,75,92,104,118,134,145,156,167],{"__ignoreMap":72},[76,77,80,84,88],"span",{"class":78,"line":79},"line",1,[76,81,83],{"class":82},"szBVR","typeof",[76,85,87],{"class":86},"sZZnC"," 'hi'",[76,89,91],{"class":90},"sJ8bj","      \u002F\u002F 'string'\n",[76,93,95,97,101],{"class":78,"line":94},2,[76,96,83],{"class":82},[76,98,100],{"class":99},"sj4cs"," 42",[76,102,103],{"class":90},"        \u002F\u002F 'number'\n",[76,105,107,109,112,115],{"class":78,"line":106},3,[76,108,83],{"class":82},[76,110,111],{"class":99}," 10",[76,113,114],{"class":82},"n",[76,116,117],{"class":90},"       \u002F\u002F 'bigint'\n",[76,119,121,123,127,131],{"class":78,"line":120},4,[76,122,83],{"class":82},[76,124,126],{"class":125},"sScJk"," Symbol",[76,128,130],{"class":129},"sVt8B","()  ",[76,132,133],{"class":90},"\u002F\u002F 'symbol'\n",[76,135,137,139,142],{"class":78,"line":136},5,[76,138,83],{"class":82},[76,140,141],{"class":99}," undefined",[76,143,144],{"class":90}," \u002F\u002F 'undefined'\n",[76,146,148,150,153],{"class":78,"line":147},6,[76,149,83],{"class":82},[76,151,152],{"class":99}," null",[76,154,155],{"class":90},"      \u002F\u002F 'object'  \u003C- historical bug; null is a primitive\n",[76,157,159,161,164],{"class":78,"line":158},7,[76,160,83],{"class":82},[76,162,163],{"class":129}," []        ",[76,165,166],{"class":90},"\u002F\u002F 'object'  \u003C- arrays aren't singled out\n",[76,168,170,172,175,178],{"class":78,"line":169},8,[76,171,83],{"class":82},[76,173,174],{"class":82}," function",[76,176,177],{"class":129},"(){} ",[76,179,180],{"class":90},"\u002F\u002F 'function'  \u003C- functions are\n",[15,182,183,184,187,188,191,192,195,196,199,200,203,204,207,208,211,212,215],{},"Primitives are ",[35,185,186],{},"immutable"," and ",[35,189,190],{},"compared by value","; objects are mutable and\n",[35,193,194],{},"compared by reference",". When you call a method on a primitive (",[19,197,198],{},"'hi'.toUpperCase()","),\nJavaScript temporarily ",[35,201,202],{},"boxes"," it in a wrapper object, then discards it — which is why\nyou should never use ",[19,205,206],{},"new Number","\u002F",[19,209,210],{},"new String"," explicitly (the result is an object,\nbreaks ",[19,213,214],{},"===",", and is always truthy).",[10,217,219],{"id":218},"null-vs-undefined","null vs undefined",[15,221,222,223,225,226,228],{},"Both mean \"no value,\" but with different intent: ",[19,224,54],{}," is the engine's default\nabsence (an unassigned variable, a missing property, a missing return); ",[19,227,50],{}," is an\nintentional \"deliberately empty\" you assign.",[67,230,232],{"className":69,"code":231,"language":71,"meta":72,"style":72},"let a            \u002F\u002F undefined\nconst obj = {}\nobj.missing      \u002F\u002F undefined\nconst b = null   \u002F\u002F null\nnull == undefined  \u002F\u002F true  (loose)\nnull === undefined \u002F\u002F false (different types)\n",[19,233,234,245,259,266,280,292],{"__ignoreMap":72},[76,235,236,239,242],{"class":78,"line":79},[76,237,238],{"class":82},"let",[76,240,241],{"class":129}," a            ",[76,243,244],{"class":90},"\u002F\u002F undefined\n",[76,246,247,250,253,256],{"class":78,"line":94},[76,248,249],{"class":82},"const",[76,251,252],{"class":99}," obj",[76,254,255],{"class":82}," =",[76,257,258],{"class":129}," {}\n",[76,260,261,264],{"class":78,"line":106},[76,262,263],{"class":129},"obj.missing      ",[76,265,244],{"class":90},[76,267,268,270,273,275,277],{"class":78,"line":120},[76,269,249],{"class":82},[76,271,272],{"class":99}," b",[76,274,255],{"class":82},[76,276,152],{"class":99},[76,278,279],{"class":90},"   \u002F\u002F null\n",[76,281,282,284,287,289],{"class":78,"line":136},[76,283,50],{"class":99},[76,285,286],{"class":82}," ==",[76,288,141],{"class":99},[76,290,291],{"class":90},"  \u002F\u002F true  (loose)\n",[76,293,294,296,299,301],{"class":78,"line":147},[76,295,50],{"class":99},[76,297,298],{"class":82}," ===",[76,300,141],{"class":99},[76,302,303],{"class":90}," \u002F\u002F false (different types)\n",[15,305,306,309,310,313],{},[19,307,308],{},"typeof null"," is the famous ",[19,311,312],{},"'object'"," bug, kept for compatibility.",[10,315,317],{"id":316},"equality-vs","Equality: == vs ===",[15,319,320,322,323,326,327,330,331,334],{},[19,321,214],{}," (strict) compares value ",[35,324,325],{},"and"," type with no conversion. ",[19,328,329],{},"=="," (loose) ",[35,332,333],{},"coerces","\nthe operands first, producing surprising results.",[67,336,338],{"className":69,"code":337,"language":71,"meta":72,"style":72},"0 === ''    \u002F\u002F false\n0 == ''     \u002F\u002F true  (both coerce to 0)\n0 == '0'    \u002F\u002F true\n'' == '0'   \u002F\u002F false  (not even transitive!)\nNaN == NaN  \u002F\u002F false\n[] == ![]   \u002F\u002F true   ([]->'', ![]->false->0, ''->0)\n",[19,339,340,353,364,376,388,401],{"__ignoreMap":72},[76,341,342,345,347,350],{"class":78,"line":79},[76,343,344],{"class":99},"0",[76,346,298],{"class":82},[76,348,349],{"class":86}," ''",[76,351,352],{"class":90},"    \u002F\u002F false\n",[76,354,355,357,359,361],{"class":78,"line":94},[76,356,344],{"class":99},[76,358,286],{"class":82},[76,360,349],{"class":86},[76,362,363],{"class":90},"     \u002F\u002F true  (both coerce to 0)\n",[76,365,366,368,370,373],{"class":78,"line":106},[76,367,344],{"class":99},[76,369,286],{"class":82},[76,371,372],{"class":86}," '0'",[76,374,375],{"class":90},"    \u002F\u002F true\n",[76,377,378,381,383,385],{"class":78,"line":120},[76,379,380],{"class":86},"''",[76,382,286],{"class":82},[76,384,372],{"class":86},[76,386,387],{"class":90},"   \u002F\u002F false  (not even transitive!)\n",[76,389,390,393,395,398],{"class":78,"line":136},[76,391,392],{"class":99},"NaN",[76,394,286],{"class":82},[76,396,397],{"class":99}," NaN",[76,399,400],{"class":90},"  \u002F\u002F false\n",[76,402,403,406,408,411,414],{"class":78,"line":147},[76,404,405],{"class":129},"[] ",[76,407,329],{"class":82},[76,409,410],{"class":82}," !",[76,412,413],{"class":129},"[]   ",[76,415,416],{"class":90},"\u002F\u002F true   ([]->'', ![]->false->0, ''->0)\n",[15,418,419,420,422,423,426,427,430,431,437,438,441,442,187,444,446,447,449,450,453,454,457,458,460,461,463,464,467,468,470],{},"The ",[19,421,329],{}," algorithm, simplified: same type -> compare directly; ",[19,424,425],{},"null == undefined"," is a\nspecial ",[19,428,429],{},"true","; number vs string -> string->number; boolean -> number; object vs primitive\n-> convert the object to a primitive, then retry. ",[35,432,433,434,436],{},"Prefer ",[19,435,214],{}," almost always."," The one\ncommon idiom is ",[19,439,440],{},"x == null",", which matches both ",[19,443,50],{},[19,445,54],{},". For the ",[19,448,392],{},"\u002F\n",[19,451,452],{},"-0"," edge cases, ",[19,455,456],{},"Object.is"," is like ",[19,459,214],{}," but treats ",[19,462,392],{}," as equal to itself and ",[19,465,466],{},"+0","\ndistinct from ",[19,469,452],{},".",[10,472,474],{"id":473},"coercion","Coercion",[15,476,477,478,481,482,485,486,489,490,493,494,497,498,501],{},"Coercion is automatic type conversion, ",[35,479,480],{},"implicit"," (",[19,483,484],{},"'5' * 2",") or ",[35,487,488],{},"explicit","\n(",[19,491,492],{},"Number('5')","). The operator that trips everyone up is ",[19,495,496],{},"+",": if either side is a string\nit does ",[35,499,500],{},"string concatenation","; the other arithmetic operators force numbers.",[67,503,505],{"className":69,"code":504,"language":71,"meta":72,"style":72},"1 + '2'    \u002F\u002F '12'   (+ with a string -> concat)\n1 - '2'    \u002F\u002F -1     (- forces numeric)\n'5' * '2'  \u002F\u002F 10\ntrue + 1   \u002F\u002F 2      (true -> 1)\n[] + {}    \u002F\u002F '[object Object]'\n",[19,506,507,521,533,546,558],{"__ignoreMap":72},[76,508,509,512,515,518],{"class":78,"line":79},[76,510,511],{"class":99},"1",[76,513,514],{"class":82}," +",[76,516,517],{"class":86}," '2'",[76,519,520],{"class":90},"    \u002F\u002F '12'   (+ with a string -> concat)\n",[76,522,523,525,528,530],{"class":78,"line":94},[76,524,511],{"class":99},[76,526,527],{"class":82}," -",[76,529,517],{"class":86},[76,531,532],{"class":90},"    \u002F\u002F -1     (- forces numeric)\n",[76,534,535,538,541,543],{"class":78,"line":106},[76,536,537],{"class":86},"'5'",[76,539,540],{"class":82}," *",[76,542,517],{"class":86},[76,544,545],{"class":90},"  \u002F\u002F 10\n",[76,547,548,550,552,555],{"class":78,"line":120},[76,549,429],{"class":99},[76,551,514],{"class":82},[76,553,554],{"class":99}," 1",[76,556,557],{"class":90},"   \u002F\u002F 2      (true -> 1)\n",[76,559,560,562,564,567],{"class":78,"line":136},[76,561,405],{"class":129},[76,563,496],{"class":82},[76,565,566],{"class":129}," {}    ",[76,568,569],{"class":90},"\u002F\u002F '[object Object]'\n",[15,571,572,573,576,577,580,581,584,585,588,589,51,591,588,594,597,598,588,601,603,604,606,607,610,611,614,615,617],{},"Objects coerce via ",[19,574,575],{},"Symbol.toPrimitive",", then ",[19,578,579],{},"valueOf"," (number hint) or ",[19,582,583],{},"toString","\n(string hint). Arrays coerce to a comma-joined string, so ",[19,586,587],{},"Number([])"," is ",[19,590,344],{},[19,592,593],{},"Number([5])",[19,595,596],{},"5",", and ",[19,599,600],{},"Number([1,2])",[19,602,392],{}," — the source of the ",[19,605,21],{},"\npuzzles. Template literals always coerce to string, which is why ",[19,608,609],{},"${obj}"," yields\n",[19,612,613],{},"[object Object]"," unless you override ",[19,616,583],{}," or interpolate a specific field.",[10,619,621],{"id":620},"truthy-and-falsy","Truthy and falsy",[15,623,624,625,628],{},"There are exactly ",[35,626,627],{},"eight falsy values","; everything else is truthy.",[67,630,632],{"className":69,"code":631,"language":71,"meta":72,"style":72},"false, 0, -0, 0n, '', null, undefined, NaN  \u002F\u002F the only falsy values\n",[19,633,634],{"__ignoreMap":72},[76,635,636,639,641,643,645,648,650,652,654,656,658,660,662,664,666,668,670,672],{"class":78,"line":79},[76,637,638],{"class":99},"false",[76,640,22],{"class":129},[76,642,344],{"class":99},[76,644,22],{"class":129},[76,646,647],{"class":82},"-",[76,649,344],{"class":99},[76,651,22],{"class":129},[76,653,344],{"class":99},[76,655,114],{"class":82},[76,657,22],{"class":129},[76,659,380],{"class":86},[76,661,22],{"class":129},[76,663,50],{"class":99},[76,665,22],{"class":129},[76,667,54],{"class":99},[76,669,22],{"class":129},[76,671,392],{"class":99},[76,673,674],{"class":90},"  \u002F\u002F the only falsy values\n",[15,676,677,678,682,683,22,686,22,689,692,693,696,697,470],{},"The traps are values people ",[679,680,681],"em",{},"expect"," to be falsy but aren't: ",[19,684,685],{},"'0'",[19,687,688],{},"'false'",[19,690,691],{},"[]",",\nand ",[19,694,695],{},"{}"," are all ",[35,698,699],{},"truthy",[67,701,703],{"className":69,"code":702,"language":71,"meta":72,"style":72},"if ([]) console.log('runs!')  \u002F\u002F empty array is truthy\nBoolean('0') \u002F\u002F true\n",[19,704,705,728],{"__ignoreMap":72},[76,706,707,710,713,716,719,722,725],{"class":78,"line":79},[76,708,709],{"class":82},"if",[76,711,712],{"class":129}," ([]) console.",[76,714,715],{"class":125},"log",[76,717,718],{"class":129},"(",[76,720,721],{"class":86},"'runs!'",[76,723,724],{"class":129},")  ",[76,726,727],{"class":90},"\u002F\u002F empty array is truthy\n",[76,729,730,733,735,737,740],{"class":78,"line":94},[76,731,732],{"class":125},"Boolean",[76,734,718],{"class":129},[76,736,685],{"class":86},[76,738,739],{"class":129},") ",[76,741,742],{"class":90},"\u002F\u002F true\n",[15,744,745,746,207,749,752,753,756,757,760,761,763,764,207,766,768,769,771,772,774],{},"This matters for conditions, ",[19,747,748],{},"||",[19,750,751],{},"&&",", and the ",[35,754,755],{},"nullish coalescing"," operator ",[19,758,759],{},"??",",\nwhich (unlike ",[19,762,748],{},") only falls back on ",[19,765,50],{},[19,767,54],{},", not on ",[19,770,344],{}," or ",[19,773,380],{},":",[67,776,778],{"className":69,"code":777,"language":71,"meta":72,"style":72},"const count = 0\ncount || 10  \u002F\u002F 10 treats valid 0 as missing\ncount ?? 10  \u002F\u002F 0\n",[19,779,780,792,804],{"__ignoreMap":72},[76,781,782,784,787,789],{"class":78,"line":79},[76,783,249],{"class":82},[76,785,786],{"class":99}," count",[76,788,255],{"class":82},[76,790,791],{"class":99}," 0\n",[76,793,794,797,799,801],{"class":78,"line":94},[76,795,796],{"class":129},"count ",[76,798,748],{"class":82},[76,800,111],{"class":99},[76,802,803],{"class":90},"  \u002F\u002F 10 treats valid 0 as missing\n",[76,805,806,808,810,812],{"class":78,"line":106},[76,807,796],{"class":129},[76,809,759],{"class":82},[76,811,111],{"class":99},[76,813,814],{"class":90},"  \u002F\u002F 0\n",[15,816,817,818,821,822,825,826,828,829,470],{},"Pair it with ",[35,819,820],{},"optional chaining"," ",[19,823,824],{},"?.",", which short-circuits to ",[19,827,54],{}," instead of\nthrowing: ",[19,830,831],{},"user?.address?.city ?? 'unknown'",[10,833,835],{"id":834},"numbers-nan-and-bigint","Numbers, NaN, and BigInt",[15,837,838],{},"All JS numbers are 64-bit IEEE-754 doubles, so decimal fractions are approximate:",[67,840,842],{"className":69,"code":841,"language":71,"meta":72,"style":72},"0.1 + 0.2            \u002F\u002F 0.30000000000000004\n0.1 + 0.2 === 0.3    \u002F\u002F false\nMath.abs(0.1 + 0.2 - 0.3) \u003C Number.EPSILON \u002F\u002F true — compare with a tolerance\n",[19,843,844,857,872],{"__ignoreMap":72},[76,845,846,849,851,854],{"class":78,"line":79},[76,847,848],{"class":99},"0.1",[76,850,514],{"class":82},[76,852,853],{"class":99}," 0.2",[76,855,856],{"class":90},"            \u002F\u002F 0.30000000000000004\n",[76,858,859,861,863,865,867,870],{"class":78,"line":94},[76,860,848],{"class":99},[76,862,514],{"class":82},[76,864,853],{"class":99},[76,866,298],{"class":82},[76,868,869],{"class":99}," 0.3",[76,871,352],{"class":90},[76,873,874,877,880,882,884,886,888,890,892,894,897,900],{"class":78,"line":106},[76,875,876],{"class":129},"Math.",[76,878,879],{"class":125},"abs",[76,881,718],{"class":129},[76,883,848],{"class":99},[76,885,514],{"class":82},[76,887,853],{"class":99},[76,889,527],{"class":82},[76,891,869],{"class":99},[76,893,739],{"class":129},[76,895,896],{"class":82},"\u003C",[76,898,899],{"class":129}," Number.EPSILON ",[76,901,902],{"class":90},"\u002F\u002F true — compare with a tolerance\n",[15,904,905,906,908,909,914,915,918,919,921,922,924,925,928,929,481,934,937,938,940,941,944],{},"For money, use integer cents or a decimal library. ",[19,907,392],{}," (\"Not-a-Number\") is the only\nvalue not equal to itself, so detect it with ",[35,910,911],{},[19,912,913],{},"Number.isNaN"," (not the global\n",[19,916,917],{},"isNaN",", which coerces). ",[19,920,392],{}," is contagious — any arithmetic with it yields ",[19,923,392],{},". For\nintegers beyond ",[19,926,927],{},"2^53 - 1",", use ",[35,930,931],{},[19,932,933],{},"BigInt",[19,935,936],{},"10n","), but you can't mix ",[19,939,933],{}," and\n",[19,942,943],{},"Number"," in arithmetic.",[10,946,948],{"id":947},"type-checking","Type checking",[67,950,952],{"className":69,"code":951,"language":71,"meta":72,"style":72},"typeof x === 'function' \u002F\u002F reliable for callables\nArray.isArray(x)        \u002F\u002F the ONLY reliable array check (typeof [] is 'object')\nx === null              \u002F\u002F explicit null check\nNumber.isNaN(x)         \u002F\u002F NaN check\n",[19,953,954,969,983,995],{"__ignoreMap":72},[76,955,956,958,961,963,966],{"class":78,"line":79},[76,957,83],{"class":82},[76,959,960],{"class":129}," x ",[76,962,214],{"class":82},[76,964,965],{"class":86}," 'function'",[76,967,968],{"class":90}," \u002F\u002F reliable for callables\n",[76,970,971,974,977,980],{"class":78,"line":94},[76,972,973],{"class":129},"Array.",[76,975,976],{"class":125},"isArray",[76,978,979],{"class":129},"(x)        ",[76,981,982],{"class":90},"\u002F\u002F the ONLY reliable array check (typeof [] is 'object')\n",[76,984,985,988,990,992],{"class":78,"line":106},[76,986,987],{"class":129},"x ",[76,989,214],{"class":82},[76,991,152],{"class":99},[76,993,994],{"class":90},"              \u002F\u002F explicit null check\n",[76,996,997,1000,1002,1005],{"class":78,"line":120},[76,998,999],{"class":129},"Number.",[76,1001,917],{"class":125},[76,1003,1004],{"class":129},"(x)         ",[76,1006,1007],{"class":90},"\u002F\u002F NaN check\n",[15,1009,1010,1013,1014,1017,1018,1021,1022,1024,1025,1028,1029,1032,1033,207,1035,1037],{},[19,1011,1012],{},"Array.isArray"," beats ",[19,1015,1016],{},"instanceof Array",", which breaks across realms (an array from an\n",[19,1019,1020],{},"\u003Ciframe>"," has a different constructor). And ",[19,1023,83],{}," is special-cased to ",[35,1026,1027],{},"not throw","\nfor undeclared identifiers, making it safe for feature detection (",[19,1030,1031],{},"typeof window !== 'undefined'",") — though it still throws for ",[19,1034,238],{},[19,1036,249],{}," in the temporal dead zone.",[10,1039,1041],{"id":1040},"recap","Recap",[15,1043,1044,1045,1048,1049,1051,1052,1054,1055,1057,1058,207,1060,1062,1063,1067,1068,1070,1071,1073,1074,207,1076,1078,1079,1081,1082,1084,1085,1087],{},"JavaScript has seven immutable, value-compared ",[35,1046,1047],{},"primitives"," and one reference-compared\n",[35,1050,64],{}," type. ",[35,1053,474],{}," converts between them — ",[19,1056,496],{}," prefers strings, other\noperators prefer numbers, objects go through ",[19,1059,579],{},[19,1061,583],{},". Prefer ",[35,1064,1065],{},[19,1066,214],{}," to\navoid ",[19,1069,329],{},"'s surprises, memorize the ",[35,1072,627],{},", and reach for ",[19,1075,759],{},[19,1077,824],{}," for\nsafe defaults and access. Mind floating-point precision, detect ",[19,1080,392],{}," with\n",[19,1083,913],{},", and check arrays with ",[19,1086,1012],{},". Know these rules and the\ncoercion brain-teasers become straightforward derivations.",[1089,1090,1091],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":72,"searchDepth":94,"depth":94,"links":1093},[1094,1095,1096,1097,1098,1099,1100,1101,1102],{"id":12,"depth":94,"text":13},{"id":29,"depth":94,"text":30},{"id":218,"depth":94,"text":219},{"id":316,"depth":94,"text":317},{"id":473,"depth":94,"text":474},{"id":620,"depth":94,"text":621},{"id":834,"depth":94,"text":835},{"id":947,"depth":94,"text":948},{"id":1040,"depth":94,"text":1041},"JavaScript interview questions on primitive types, type coercion, == vs ===, truthy\u002Ffalsy values and checking types, with examples.","medium","md","JavaScript","javascript",{},true,"\u002Fblog\u002Fjavascript-data-types-type-coercion","\u002Fjavascript\u002Ffundamentals\u002Fdata-types-coercion",{"title":5,"description":1103},"blog\u002Fjavascript-data-types-type-coercion","Data Types & Coercion","Fundamentals","fundamentals","2026-06-17","-ifiVCdh45o3UAzvJtgQbjqYZCzs_HQHcfaOIYAAfi4",1781808673080]