Assignment-JS-4
-
Write a function that takes an array of numbers as input and returns the sum of all even numbers in the array.
-
Write a function that takes a string as input and returns the number of vowels in the string.
-
Write a function that takes an array of strings as input and returns the length of the longest string in the array.
-
Write a function that takes an array of numbers as input and returns the average of all the numbers in the array.
-
Write a function that takes an object as input and returns an array of all the keys in the object.
-
Write a function that takes an array of objects as input and returns an array of all the values for a specified key in each object.
-
Write a function that takes an array of strings as input and returns an array of all the unique strings in the array.
-
Write a function that takes an array of numbers as input and returns the product of all the numbers in the array.
-
Function to sum all even numbers in an array: Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Output: 30
-
Function to count the number of vowels in a string: Input: "hello world" Output: 3
-
Function to find the length of the longest string in an array: Input: ["apple", "banana", "pear", "grapefruit"] Output: 10
-
Function to find the average of all the numbers in an array: Input: [1, 2, 3, 4, 5] Output: 3
-
Function to return an array of all the keys in an object: Input: { name: "John", age: 30, city: "New York" } Output: ["name", "age", "city"]
-
Function to return an array of all the values for a specified key in each object: Input: [{ name: "John", age: 30 }, { name: "Mary", age: 25 }, { name: "Peter", age: 35 }] Output: ["John", "Mary", "Peter"]
-
Function to return an array of all the unique strings in an array: Input: ["apple", "banana", "apple", "pear", "pear", "orange"] Output: ["apple", "banana", "pear", "orange"]
-
Function to return the product of all the numbers in an array: Input: [1, 2, 3, 4, 5] Output: 120