-3

I've got an array with 10 cars. I'd like to print all cars from numbers 2 to 10.

Here's my array:

var car = ["Abarth", "Acura", "Alfa Romeo", "AMC", "Aston Martin", "Autobianchi", "Audi", "Austin", "Bentley", "BMW"];

How can I do it?

Ivo Mori
  • 2,177
  • 5
  • 24
  • 35
  • 1
    Welcome to Stack Overflow. Try to ask a specific question based on your own attempt to solve this problem (by also showing us your code). Also note that searching SO for already answered questions may very well answer yours as well. In your particular case, you'll also find many tutorials (google for it) on how to work with Arrays in JavaScript. Finally, have a look at [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). – Ivo Mori May 20 '20 at 04:27

1 Answers1

-1

You can use : car.splice(2)

For more detail on splice : DO READ


var car = ["Abarth", "Acura", "Alfa Romeo", "AMC", "Aston Martin", "Autobianchi", "Audi", "Austin", "Bentley", "BMW"];

console.log(car.splice(2));
Vivek Doshi
  • 56,649
  • 12
  • 110
  • 122