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?
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?
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));