Skip to content

Instantly share code, notes, and snippets.

@stagas
stagas / check.js
Created December 1, 2010 12:17
typeof alternative
// typeof alternative
var check = function() {
var args = Array.prototype.slice.call(arguments)
, o = args[0]
, a = args.slice(1)
if (typeof o !== 'undefined' && (typeof o[a[0]] !== 'undefined') || !a.length && typeof o !== 'undefined')
if (a.length > 1) {
b = o[a[0]]