Skip to content

Instantly share code, notes, and snippets.

@rodrigo-x
Created October 15, 2012 00:28
Show Gist options
  • Save rodrigo-x/3890273 to your computer and use it in GitHub Desktop.
Save rodrigo-x/3890273 to your computer and use it in GitHub Desktop.
snippet - conceito..
// Bruxarias...
var teste1 = null;
var teste2 = [1, 2, 3, 4, 5, 6];
var teste3 = new Number(10);
var teste4 = 10;
var teste5 = new Array(1, 2, 3, 4, 5);
console.log(typeof teste1); //Como é? O null é um objeto? O.o
console.log(typeof teste2); //Como é? O certo seria retornar um array.. o.O
console.log(typeof teste3); //OK é um número...
console.log(typeof teste4); //Correto sem bruxaria...
console.log(typeof teste5); //Não seria um array? O.o wtf!
var isArray = (function(x){ return Object.prototype.toString.call(x); });
if(isArray( teste2 ) === '[object Array]')
alert( 'Array!' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment