JSFiddle - React, Tailwind, and code Playground

HTML

<div id="output" style="white-space: pre"></div>

JavaScript

// Begin public utility /getVarType/
// Returns 'Function', 'Object', 'Array',
// 'String', 'Number', 'Null', 'Boolean', or 'Undefined'
var typeofMap = {
  'undefined' : 'Undefined',
  'boolean'   : 'Boolean',
  'number'    : 'Number',
  'string'    : 'String',
  'function'  : 'Function',
        
  'Undefined' : 'Undefined',
  'Null'      : 'Null',
  'Boolean'   : 'Boolean',
  'Number'    : 'Number',
  'String'    : 'String',
  'Function'  : 'Function',
  'Array'     : 'Array'
},
    
getVarType = function ( data ) {
  var type, type_str;
  if ( data === null ) { return 'Null'; }
  if ( data === undefined ) { return 'Undefined'; }
    
  type     = typeof( data );
  type_str = typeofMap[ type ];
  if ( type_str ) { return type_str; }
    
  type = {}.toString.call( data ).slice( 8, -1 );
  return typeofMap[ type ]
    || ( data.propertyIsEnumerable(0) && data.length !== undefined
      ? 'Array' : 'Object'
    );
},
// End public utility /getVarType/



und1  = undefined,
null1 = null,
bool1 = true,
str1  = 'cde',
num1  = 25,
list1 = [ 'a','b','c' ],

bool2 = new Boolean(),
str2  = new String(),
num2  = new Number(),
list2 = new Array(),
obj   = { length : 3 },
olist = [],
el = document.getElementById('output');

olist.push( '\n\n=========== getVarType ==============' );
olist.push( getVarType( und1  ) );
olist.push( getVarType( null1 ) );
olist.push( getVarType( bool1 ) );
olist.push( getVarType( str1  ) );
olist.push( getVarType( num1  ) );
olist.push( getVarType( list1 ) );
olist.push( getVarType( bool2 ) );
olist.push( getVarType( str2  ) );
olist.push( getVarType( num2  ) );
olist.push( getVarType( list2 ) );
olist.push( getVarType( document.location ) );
olist.push( getVarType( document.styleSheets ) );
olist.push( getVarType( document.styleSheets ) );
olist.push( getVarType( obj ) );

olist.push( '\n\n=========== typeof ==============' );
olist.push( typeof( und1  ) );
olist.push( typeof( null1 ) );
olist.push( typeof( bool1 ) );
olist.push( typeof( str1 ...