JSFiddle - React, Tailwind, and code Playground
HTML
<code id="seeTime"></code>
JavaScript
(function() {
var
myconsole = function(ref) {
var times = [], xwrite = $("#seeTime");
this.time = function(data) {
times[data] = (new Date()).getTime();
}
this.timeEnd = function(data) {
xwrite.append("<span><b>"+data+":</b> "+((new Date()).getTime() - times[data])+"ms</span><br />");
}
return this;
}.call({});
var
loops = 1e6,
foo,
undefined;
myconsole.time('typeof');
while(loops--) {
if( typeof foo !== 'undefined' ) {}
}
myconsole.timeEnd('typeof');
loops = 1e6;
myconsole.time('undefined');
while(loops--) {
if( foo !== undefined) {}
}
myconsole.timeEnd('undefined');
loops = 1e6;
myconsole.time('void 0');
while(loops--) {
if( foo !== void 0) {}
}
myconsole.timeEnd('void 0');
}());