Skip to content
 
 

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Winter Break Explore

Instructions

  • Create a replit and write your solutions there. By the end of the winter break or once you finish all the exercises send the link for the replit to your instructors
  • To test your functions, you'll need to come up with your examples. Think about different scenarios and input values that will help you verify that your functions work correctly. Feel free to experiment and explore!
  • You can also paste your solution in chatGPT and ask it to generate examples for you!
  • You will probably need to do some research to understand how to use certain methods but you got it!

find

  1. Find First Even Number:

    • Create a function findFirstEven that takes an array of numbers and uses the find method to find the first even number in the array.
  2. Find Student by Name:

    • Create a function findStudentByName that takes an array of objects with student information (name and age) and uses the find method to find the object of the student with a specific name.
  3. Find First Undefined Value:

    • Create a function findFirstUndefined that takes an array of mixed data types (numbers, strings, and undefined) and uses the find method to find the first undefined value in the array.
  4. Find Index of 'A' String:

    • Create a function findIndexOfA that takes an array of strings and uses the find method to find the index of the first string that starts with the letter 'A'.
  5. Find Book by Author:

    • Create a function findBookByAuthor that takes an array of objects representing books (with title and author) and uses the find method to find the first book written by a specific author.

filter

  1. Filter Even Numbers:

    • Create a function filterEvenNumbers that takes an array of numbers and uses the filter method to create a new array containing only the even numbers.
  2. Filter Long Strings:

    • Create a function filterLongStrings that takes an array of strings and uses the filter method to create a new array containing only the strings with more than five characters.
  3. Filter Students Older Than 20:

    • Create a function filterOlderStudents that takes an array of objects with student information and uses the filter method to create a new array containing only the students who are older than 20.
  4. Filter Numbers Greater Than 10:

    • Create a function filterGreaterThanTen that takes an array of numbers and uses the filter method to create a new array containing only the numbers greater than 10.
  5. Filter Arrays of a Specific Length:

  • Create a function filterArraysByLength that takes an array of arrays and uses the filter method to create a new array containing only arrays with a specific length.

map

  1. Map Numbers Squared:

    • Create a function mapNumbersSquared that takes an array of numbers and uses the map method to create a new array where each number is squared.
  2. Map Strings Uppercase:

    • Create a function mapStringsUppercase that takes an array of strings and uses the map method to create a new array where each string is converted to uppercase.
  3. Map Students Names:

    • Create a function mapStudentsNames that takes an array of objects with student information and uses the map method to create a new array containing only the names of the students.
  4. Map Numbers to Booleans:

    • Create a function mapNumbersToBooleans that takes an array of numbers and uses the map method to create a new array where each number is converted to a boolean (even or odd).
  5. Map Array Lengths:

    • Create a function mapArrayLengths that takes an array of arrays and uses the map method to create a new array containing only the lengths of the nested arrays.

forEach

  1. ForEach Log Numbers:

    • Create a function forEachLogNumbers that takes an array of numbers and uses the forEach method to log each number to the console.
  2. ForEach Log Strings with Exclamation:

    • Create a function forEachLogWithExclamation that takes an array of strings and uses the forEach method to log each string to the console with an exclamation point added.
  3. ForEach Log Students:

    • Create a function forEachLogStudents that takes an array of objects with student information and uses the forEach method to log each student's name and age to the console.
  4. ForEach Double Numbers:

    • Create a function forEachDoubleNumbers that takes an array of numbers and uses the forEach method to double each number in the array.
  5. ForEach Log Index and String:

    • Create a function forEachLogIndexAndString that takes an array of strings and uses the forEach method to log each string along with its index in the array.

sort

  1. Sort Numbers Ascending:

    • Create a function sortNumbersAscending that takes an array of numbers and uses the sort method to sort the numbers in ascending order.
  2. Sort Strings Alphabetically:

    • Create a function sortStringsAlphabetically that takes an array of strings and uses the sort method to sort the strings in alphabetical order.
  3. Sort Books by Title:

    • Create a function sortBooksBy Title that takes an array of objects representing books (with title and author) and uses the sort method to sort the books based on their titles in alphabetical order.

reduce

  1. Reduce Sum of Numbers:

    • Create a function reduceSumOfNumbers that takes an array of numbers and uses the reduce method to calculate the sum of all numbers in the array.
  2. Reduce Concatenate Strings:

    • Create a function reduceConcatenateStrings that takes an array of strings and uses the reduce method to concatenate all strings into a single sentence.
  3. Reduce Average Age:

    • Create a function reduceAverageAge that takes an array of objects with student information (name and age) and uses the reduce method to calculate the average age of the students.
  4. Reduce Product of Numbers:

    • Create a function reduceProductOfNumbers that takes an array of numbers and uses the reduce method to calculate the product of all numbers in the array.
  5. Reduce Total Array Length:

    • Create a function reduceTotalArrayLength that takes an array of arrays and uses the reduce method to calculate the total number of elements in all nested arrays.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors