- Question: Given an array
numbers
, how do you add a new element5
to the end of the array? - Question: How can you check if an array
fruits
contains the value"apple"
? - Question: What method can you use to remove the last element from an array
colors
? - Question: How do you find the number of elements in an array
grades
? - Question: Given an array
words
, how can you join all its elements into a single string separated by commas? - Question:: Given an array fruits, how do you add a new element "banana" to the beginning of the array?
- Question:: How can you check if an array numbers is empty (contains no elements)?
- Question:: What method can you use to remove the first element from an array animals?
- Question:: How do you find the largest number in an array scores?
- Question:: Given an array names, how can you add multiple names, "Alice" and "Bob", to the end of the array in one step?
- Question: Write a function that takes an array of numbers and returns the sum of all the positive numbers in the array.
- Question: Given an array
names
, how can you create a new array containing only the names that start with the letter"A"
? - Question: How do you reverse the order of elements in an array
characters
? - Question: Write a function that takes an array of strings and returns a new array with the strings sorted in alphabetical order.
- Question: Given an array
numbers
, how can you find the index of the first occurrence of the number7
? - Question:: Write a function that takes an array of strings and returns the longest string in the array.
- Question:: Given two arrays, arr1 and arr2, how can you combine them into a single array combinedArray?
- Question:: How do you remove all duplicate values from an array values?
- Question:: Write a function that takes an array of objects representing people with name, age, and city properties and returns an array of just the names.
- Question:: Given an array numbers, how do you find the sum of all even numbers in the array?
- Question: Write a function that takes an array of numbers and returns a new array with only the unique values (no duplicates).
- Question: How can you implement a custom
map
function that works like the built-inArray.prototype.map
? - Question: Write a function that takes two arrays,
arr1
andarr2
, and returns a new array containing the elements that appear in both arrays (intersection). - Question: Given an array of objects
people
, how can you find the person with the highest age? - Question: Write a function that takes an array of numbers and returns the median (middle value) of the numbers.
- Question: Write a function that takes an array of objects representing books with title, author, and publicationYear properties and returns an array of books published before the year 2000.
- Question: How can you implement a custom filter function that works like the built-in Array.prototype.filter?
- Question: Write a function that takes an array of numbers and returns a new array with the numbers squared.
- Question: Given two sorted arrays, arr1 and arr2, write a function to merge them into a single sorted array.
- Question: Write a function that takes an array of words and returns an object that counts how many times each word appears in the array.