JSFiddle - React, Tailwind, and code Playground

by davidpauljunior

JavaScript

function checkBool(obj) {
  // From Umar
  // `!typeof({})` evals to `false` because `!"object"` coerces     `"object"` to a boolean and `!true` is `false` so you're saying `if (false == 'object')`
	if (!typeof(obj) == 'object') {
      console.log('1');
  }
  
  if (typeof(obj) != 'object') {
  	 console.log('2');
  }
  return;
}

console.log(checkBool({hello: 'bob'}));