Created
December 6, 2016 19:36
-
-
Save JuarezLustosa/292b59e3f36155906f1482e2ec9eaa7d to your computer and use it in GitHub Desktop.
Javascript Desempenho entre typeof e direct
This file contains 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
var loops = 1e8, | |
foo; | |
console.time('typeof'); | |
while(loops--) { | |
if( typeof foo !== 'undefined' ) {} | |
} | |
console.timeEnd('typeof'); | |
loops = 1e8; | |
console.time('direct'); | |
while(loops--) { | |
if( foo !== undefined) {} | |
} | |
console.timeEnd('direct'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment