/** * Challenge: Build and modify an array * - Build an array with 8 items * - Remove the last item * - Add the last item as the first item on the array * - Sort the items by alphabetical order * - Use the find() method to find a specific item in the array * - Remove the item you found using the find method from the array. */ let array1 = ["Vanaja", "Priya", "Lakshmi", 5, 7, 10]; console.log(array1); console.log(array1[0]); console.log(array1.length); //console.log(array1.pop()); console.log(array1); //console.log(array1.push(10)); //console.log(array1); array1.unshift("Rohan"); let last = array1.pop(); array1.unshift(last); console.log(array1); let array2 = ["asd", "dfer", "rtdf", "bsd"]; console.log(array2); array1.sort(); console.log(array2); //array1.find("asd"); array2.find(function (value, index) { console.log("Visited index ", index, " with value ", value); }); array2.includes("asd"); var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; for (var i = 0; i < arr.length; i++) { if (arr[i] === 5) { arr.splice(i, 1); } }