Get specific elements from an array

A simple example of getting specific elements from an array.
<!DOCTYPE html>
<html>
<head>
   
</head>
<body>

<script>
    
          var vehicles = ["Lamborghini", "Ferrari", "A-10 Thunderbolt", "F-16", "Mi-7", "T-34/85", "Titanic"];
          
              console.log("Base Array (vehicles) = " + vehicles);
		
          var planes = vehicles.slice(2,4);

              console.log("New array (planes) = " + planes);
    
</script>

</body>
</html>

Responses

0 Replies