Array-3

 

In this example, how we declare arrays using new array keyword. var vehicles= new Array("Xuv", "Sonata", "BMW"); See the code snippet:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p id="sample"></p> <script> var vehicles= new Array("Xuv", "Sonata", "BMW"); document.getElementById("sample").innerHTML = vehicles[0]; </script> </body> </html>
Output