Created
October 15, 2012 00:28
-
-
Save rodrigo-x/3890273 to your computer and use it in GitHub Desktop.
snippet - conceito..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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