Solution | JavaScript Programing Challenge ForEach -solution

Опубликовано: 31 Январь 2023
на канале: Karan
102
3

Join us in this coding challenge as we demonstrate a solution to a JavaScript problem using the powerful forEach method. We'll show you how to iterate over an array and perform specific operations on each element. Perfect for those who are looking to improve their JavaScript skills! Watch now.

Julia and Kate are doing a study on dogs.
So each of them asked 5 dog owners about
their dog's age, and stored the data into
an array (one array for each). For now, they
are just interested in knowing whether a dog is
an adult or a puppy. A dog is an adult if it is
at least 3 years old, and it's a puppy if it's
less than 3 years old.
Create a function 'checkDogs', which accepts 2
arrays of dog's ages ('dogsJulia' and 'dogsKate'),
and does the following things:
1. Julia found out that the owners of the FIRST
and the LAST TWO dogs actually have cats, not dogs!
So create a shallow copy of Julia's array, and remove
the cat ages from that copied array (because it's
a bad practice to mutate function parameters)
2. Create an array with both Julia's (corrected)
and Kate's data
3. For each remaining dog, log to the console
whether it's an adult ("Dog number 1 is an adult,
and is 5 years old") or a puppy ("Dog number 2 is
still a puppy 🐶")
4. Run the function for both test datasets
HINT: Use tools from all lectures in this section so far 😉
TEST DATA 1: Julia's data , Kate's data
TEST DATA 2: Julia's data , Kate's data


На этой странице сайта вы можете посмотреть видео онлайн Solution | JavaScript Programing Challenge ForEach -solution длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Karan 31 Январь 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 102 раз и оно понравилось 3 зрителям. Приятного просмотра!