JSFiddle - React, Tailwind, and code Playground
JavaScript
var varsToTest = {
num0: 1,
num1: new Number(2),
str0: 'hello',
str1: new String('world'),
arr0: [],
arr1: new Array(),
obj0: {},
obj1: new Object(),
fnc0: function() { alert('Hi!'); },
fnc1: new Function("alert(1)"),
nul: null,
und: undefined
}
var types = [Number, String, Array, Function, Object];
for (var prop in varsToTest) {
document.writeln(prop + ' (' + typeof(varsToTest[prop]) + ')<br>');
for (var i=0; i < types.length; i++) {
if (varsToTest[prop] instanceof types[i]) {
document.writeln(prop + ' has ' + types[i] + ' in it\'s prototype chain<br>');
}
}
}