Created
June 12, 2020 04:50
-
-
Save kyktommy/3b7baffe6831588919280e0328643986 to your computer and use it in GitHub Desktop.
faster javascript methods
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
// remove from array, no seq | |
// https://jsperf.com/array-remove-by-index | |
var arr = [1,2,3] | |
var index = arr.indexOf(2) | |
arr[index] = arr[arr.length - 1] | |
arr.pop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment