Howdy, Stranger!

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

Categories

How to append values to a JavaScript array?

NickFNickF USAMember Posts: 132

I need to append some values to a JavaScript array. Can someone please explain me how to do this?

Tagged:

Comments

  • DavidMDavidM USAMember Posts: 342

    You can use push() function.

    // array initialization
    var newarray= [
        "Apple",
        "Mango",
        "Orange"
    ];
    
    // append new value
    newarray.push("Pineapple");
    
Sign In or Register to comment.