Skip to content

JavaScript list | No ArrayList in JS | Use Array methods

  • by

Is there a list in JavaScript?

No, JavaScript does not have a list or an Array List. But there is an Array that has a slimmer functionalist. An array variable can hold more than one value at a time.

Simple Example of JavaScript Arrays.

    <title>Sample Code</title>  
    <script type="text/javascript">  
  	var cars = ["Ford", "Volvo", "BMW"];


list in JavaScript

JavaScript uses dynamic arrays, So no need to declare the size beforehand.

You can push and shift to arrays as many times as you want, JavaScript will handle allocation and stuff for you.

In JavaScript you can declare array as below:

var array=[];

Do comment if you have any doubts and suggestion on this tutorial.

Note: The All JS Examples codes are tested on the Safari browser (Version 12.0.2) and Chrome.
OS: macOS 10.14 Mojave
Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *