Created
December 20, 2017 04:42
-
-
Save raychew13/80ecd02501a6297ffea8062ac3ff5f8b to your computer and use it in GitHub Desktop.
JavaScripts Tips
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
var array = [2, 5, 9, 10]; | |
var index = array.indexOf(9); | |
if (index > -1) { | |
array.splice(index, 1); // delete from index 3 for 1 item. | |
} | |
console.log(array) | |
// return [ 2, 5, 10 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment