JavaScript Code Challenges: Array Manipulation
Tags: javascript, programming, webdev, beginners
Published: 2023-02-27 08:39:14


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](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/01)

**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](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/02)

**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](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/03)

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](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/03)

**4. Sum and Average**
Write a function that takes an array of numbers and returns the sum of all the numbers.

**Solution:** [sumOfNumbers.js](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/04)

Write a function that takes an array of numbers and returns the average of all the numbers.

**Solution:** [averageOfNumbers.js](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/05)

**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](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/06)

Write a function that takes an array of strings and returns the shortest string in the array.

**Solution:** [shortestString.js](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/06)

**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](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/07)

Write a function that takes an array of numbers and returns the smallest number in the array.

**Solution:** [smallestNumber.js](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/07)

**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](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/08)

Write a function that takes an array of numbers and returns a new array with only the odd numbers.

**Solution:** [oddNumbers.js](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/08)

**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](https://github.com/SidraMaq/JSCodeChallenges/tree/main/04-arrays/09)

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!