How to delete elements in a JavaScript array? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to delete elements in a JavaScript array?

Jeson84Jeson84 USAPosts: 90Member

Please explain me how to delete elements in a JavaScript array.

Tagged:

Comments

  • DavidMDavidM USAPosts: 342Member

    use splice()

    yourArray = ['a', 'b', 'c', 'd']; yourArray.splice(2,1);
    
    for (var count = 0; count < yourArray.length; count++) {
        alert(yourArray[count]);
    }
    

    this will display "a", "b", "d"

Sign In or Register to comment.