codegurukool.com · Free coding tutorials & online compiler

Home › JavaScript Tutorial › JS data types

JS data types

What kinds of values exist.

Primitives: string, number, bigint, boolean, undefined, null, symbol. Everything else is an object. Check with typeof.

Example code

<pre id='o'></pre>
<script>
const v=['a',1,10n,true,undefined,null,Symbol('s'),[],{},()=>1];
o.textContent=v.map(x=>typeof x).join(', ')+'\nArray? '+Array.isArray([]);
</script>

Run this code in the online editor

← JS RegExpJS errors →