JSFiddle - React, Tailwind, and code Playground

by Chuan Shao

JavaScript

//Test primitive type: number
var n = 42;
console.log(typeof n);

//Test primitive type: string
var s = "test";
console.log(typeof s);

//Test primitive type: boolean
var b = true;
console.log(typeof b);

//Test primitive type: null. The typeof operator will return "object" due to JavaScript bug.
var x = null;
console.log(typeof x);

//Test primitive type: undefined
var y = undefined;
console.log(typeof y);

//Test JSON object type.
var j = {"name":"Bob", "age":42};
console.log(typeof j);

//Test array object type.
var a = [2,3,5,7,11];
console.log(typeof a);

//Test function object type.
var f = function(){return true;};
console.log(typeof f);