If you're looking to practice your JavaScript skills, array manipulation is a great place to start. Here are challenges that will help you hone your skills.
1. Unique Strings
Write a function that takes an array of strings and returns a new array with only the unique strings.
Solution: uniqueStrings.js
2. Objects with Certain Properties
Write a function that takes an array of objects and returns a new array with only the objects that have a certain property.
Solution: objectsWithCertainProperties.js
3. Sorted Numbers
Write a function that takes an array of numbers and returns a new array with the numbers sorted in descending order.
Solution: sortedNumbersDescending.js
Write a function that takes an array of numbers and returns a new array with all the numbers sorted in ascending order.
Solution: sortedNumbersAscending.js
4. Sum and Average
Write a function that takes an array of numbers and returns the sum of all the numbers.
Solution: sumOfNumbers.js
Write a function that takes an array of numbers and returns the average of all the numbers.
Solution: averageOfNumbers.js
5. Longest and Shortest Strings
Write a function that takes an array of strings and returns the longest string in the array.
Solution: longestString.js
Write a function that takes an array of strings and returns the shortest string in the array.
Solution: shortestString.js
6. Largest and Smallest Numbers
Write a function that takes an array of numbers and returns the largest number in the array.
Solution: largestNumber.js
Write a function that takes an array of numbers and returns the smallest number in the array.
Solution: smallestNumber.js
7. Even and Odd Numbers
Write a function that takes an array of numbers and returns a new array with only the even numbers.
Solution: evenNumbers.js
Write a function that takes an array of numbers and returns a new array with only the odd numbers.
Solution: oddNumbers.js
8. Values of a Key in an Array of Objects
Write a function that takes an array of objects and a key, and returns a new array with the values of the specified key in each object.
Solution: valuesOfKey.js
I hope these challenges help you improve your JavaScript skills. If you have any questions or feedback, feel free to leave a comment or reach out to me on GitHub. Happy coding!
Top comments (0)