JavaScript list | No ArrayList in JS | Use Array methods

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.

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

Output:

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=[];
array.push();

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.