JavaScript Basics all 3 results with same output.
Length
let band = ["Metallica","Megadeth","Slayer","Deep Purple","Iron Maiden"] band.length = 2 console.log(band) // ["Metallica","Megadeth"]
Splice
let band = ["Metallica","Megadeth","Slayer","Deep Purple","Iron Maiden"] band = band.splice(0,2) console.log(band) // ["Metallica","Megadeth"]
Slice
let band = ["Metallica","Megadeth","Slayer","Deep Purple","Iron Maiden"] band = band.slice(0,2) console.log(band) // ["Metallica","Megadeth"]
Comments
Post a Comment