bear 月与灯依旧 2024-01-12 Javascript Array Handle element in an Array const hobbies = ["sports", "cooking", "reading"]; console.log(hobbies[0]); # Get single element hobbies.push("surfing"); # Add new element to the end hobbies.unshift("movies"); # Add new element to th start hobbies.pop(); # remove the last element hobbies.shift(); # remove the first element Find element const index = hobbies.findIndex((item) => { return item === "reading" }); console.log(index); A shorter code: const index = hobbies.findIndex((item) => item === #编程学习 #javascript