Created
April 19, 2020 05:17
-
-
Save ryanve/70b1edf9937d7ce569ad4dc8466e1be0 to your computer and use it in GitHub Desktop.
Create fresh pure new array from the indexes of an array or object based on the length
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
function pure(like) { | |
var fresh = [] | |
var i = ~~like.length | |
while (i-->0) fresh[i] = like[i] | |
return fresh | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment