Create a function useSpreadOperator that merges two arrays using the spread operator and logs the result.
addToArray
4 months agoCreate a function addToArray that adds 'orange' to the end of an array using push and logs the result.
findElement
4 months agoCreate a function findElement that checks if 'banana' exists in the array using indexOf and logs the index.
removeElement
4 months agoCreate a function removeElement that removes the last item of the array using pop and logs the updated array.
emptyArray
4 months agoCreate a function emptyArray that sets an array to empty.
combineAndSlice
4 months agoCreate a function combineAndSlice that combines two arrays and slices the result from index 1 to 3.
useSpreadOperator
4 months agoCreate a function useSpreadOperator that merges two arrays using the spread operator and logs the result.
cloneArray
4 months agoCreate a function cloneArray that creates a shallow copy of an array using the spread operator.
arrayDestructuring
4 months agoCreate a function arrayDestructuring that extracts the first and second elements using destructuring and logs them.
iterateArray
4 months agoCreate a function iterateArray that logs each element of an array using forEach.
joinArray
4 months agoCreate a function joinArray that joins array elements with a dash ('-') and logs the result.
sortArray
4 months agoCreate a function sortArray that sorts a number array in ascending order using sort().
testAllElements
4 months agoCreate a function testAllElements that checks if all numbers in the array are positive using every().
filterArray
4 months agoCreate a function filterArray that returns only even numbers from an array using filter().
mapArray
4 months agoCreate a function mapArray that doubles each number in an array using map() and logs the result.
reduceArray
4 months agoCreate a function reduceArray that returns the sum of all elements in an array using reduce().