A fiddle to test for all the actual types

Since js typeof is too lame to actually get useful types someone built the toType function (& explained it... makes pretty good sense) so I made this to find out what types I should expect

by Matt Rummler

HTML

<body id="thebody">
    
</body>

JavaScript

//setup for the test
Object.toType = (function toType(global) //taken from https://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/
{
  return function(obj) 
  {
    if (obj === global) 
    {
      return "global";
    }
    return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
  };
})(this);
//alternate forEach code taken from: http://www.sitepoint.com/jquery-vs-raw-javascript-3-events-ajax/ 
Object.forEach=(function forEach()
{
  return function(obj,fn)
  {
    if(obj.length)
    {
      for (var i = 0, ol = obj.length, v = obj[0]; i < ol && fn(v, i) !== false; v = obj[++i]);
    }
	else
    {
      for (var p in obj) if (fn(obj[p], p) === false) break;
    }
  };
})(this);
var displayTypevar = (function diplayType(variable, index)
{
    var message='the variable referred to in the associative array/object as: '+index+' is of type: '+Object.toType(variable);
    alert(message);    
});
//the test begins below
var dontInitializeMe;
var ishouldequalnull=null;
var anInt=1;
var aMath=1+2;
var afunction=function(){return 1+3;};
var anObject={};
var aString='';
var anArray=['singleItemArray'];
var aNull=null;
var htmlElement=document.createElement('div');

var TestingObject={var1:dontInitializeMe,var2:ishouldequalnull,var3:anInt,var4:aMath,var5:afunction,var_anObject:anObject,var_aString:aString,var_anArray:anArray,var_aNull:aNull,var_htmlElem:htmlElement};

Object.forEach(TestingObject,displayTypevar);

if(Object.toType(TestingObject.var_anArray)==='object')
{
   alert('This should only be seen if an array is returned by Object.toType()');
}