Last active
October 28, 2016 03:50
-
-
Save nobeans/e3ebaf59f624ea305398f26b005a193b to your computer and use it in GitHub Desktop.
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
function test(array) { | |
return Array.isArray(array) ? array.shift() : undefined | |
} | |
console.log(test([1])); | |
console.log("" + test([1])); | |
console.log(test([1, 2, 3])); | |
console.log("" + test([1, 2, 3])); | |
console.log(test([])); | |
console.log("" + test([])); | |
console.log(test(undefined)); | |
// 1 | |
// 1 | |
// 1 | |
// 1 | |
// undefined | |
// undefined | |
// undefined | |
// | |
// *** time: 0.19983 *** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment