How to push string in an array in Javascript

Created at 05-Jan-2022, By samar

How to push string in an array in Javascript

Good day, guys. In this post, we’ll look at how to solve the "How to push string in an array in Javascript" programming puzzle.

You can use push() method on array to push the specific value in Javascript. By using push method you can insert any value at the end of the array.
  • Push string value in an array of number in Javascript

    <script>
    let numArray = [1,2,4,8,9,8];
    numArray.push('Hello');
    console.log(numArray);
    </script>
    

    This code snippet add a string value in an array of numbers.

Back to code snippet queries related javascript

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.