Better way to get type of a Javascript variable?

Angus Croll recently wrote an interesting blog post about this –

Fixing the JavaScript typeof operator

He goes through the pros and cons of the various methods then defines a new method ‘toType’ –

var toType = function(obj) {
  return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)