All language subtitles for 148 Coding Challenge 1.en_US1

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Welcome back to the first coding challenge

of the arrays section.

And in this one, Julia and Kate are doing a study on dogs.

So each of them asked five dog owners about their dog's age

and then they stored that data into an array.

And that's one array for each of them.

All right?

And in this study, they are interested in knowing

whether each of the dogs is an adult or a puppy.

And the rule is that a dog is an adult

if it is at least three years old,

and it's a puppy if it's less than three years old.

And by the way, the test data here,

so the arrays for it is down here.

So test data one and two.

All right?

So, your task is to create a function called check dogs,

which accepts these two arrays

and does the following things.

So first, Julia found out that the owners of the first

and the last two dogs do actually have cats and not dogs.

So here, what I want you to do

is to create a shallow copy of Julia's array

and then remove the cat ages from the copied array.

And you should copy it because it's a bad practice

to mutate the parameters or the arguments of a function.

Then second, create an array

with both Julia's and Kate's data.

So for Julia, of course, the corrected data.

And then for each of the dogs,

simply log to the console whether it is an adult

with a string like this

or a puppy and then with a string like this.

And that's, of course, according to the rules

in the beginning.

And then, just run this function for both test data sets.

And that's it.

So all you need to do is to use the tools

from all the lectures in this section so far

and then I think you will be fine solving this on your own.

So this is really all about using the tools

that we already learned before

and there's not a lot of new thinking to do here.

So I hope you manage to do this one.

And I see you back here in a second.

All right.

So hopefully, you did this just fine without any problems

but I will anyway write my solution here

and explain what I am doing.

So, we accept the dogs from Julia

and the dogs from Kate.

And we will call this with the test data.

And so, Julia's data is this

and there's not a need to store them in separate variables.

I will just call the function like this.

All right?

And now we should create a shallow copy of dogs Julia,

so that we can then remove some elements from there.

So dogsJuliaCorrected.slice

So dogsJuliaCorrected.slice

and so I'm using here the method

and not the spread operator.

And now, I will simply remove some elements from there.

So dogsJuliaCorrected.splice

and so, it tells us that the first

and the last two dogs are not valid basically.

So, the first is element number zero

and then we want to remove one.

So that's the first part.

And then dogsJuliaCorrected.splice

and then the last two, which is minus two.

Okay?

So, let's take a look here simply at

dogsJuliaCorrected just to see

if this is correct actually.

So we need the console now.

And so this was or beginning data and indeed,

the first and the last two are done here.

All right?

Now, of course, you could have also done this

in a different way,

which is to simply copy the correct data

from the original using the slice method.

So something like this: dogsJulia.slice,

So something like this: dogsJulia.slice,

so starting from the second one

and then all the way to the third one.

Okay, and so this would give us the exact same result

but in this case, I just wanted to use the splice method.

And, in fact, I wanted you to use the splice method as well

and that's why I gave you that task like that.

Anyway, we don't need this here anymore.

Let's now simply create a new variable with both these dogs.

So simply calling it dogs.

And again, we could use the spread operator here

which I actually prefer

but since we are in the arrays section here,

let's do everything with array methods.

So that's the concat method, remember?

And then we want to join

the corrected Julia dogs with dogs Kate.

So always a good idea to check.

And yeah, that's correct.

All right?

And so, all we have to do now is

basically create this string.

Let me just copy this string.

And so, looping over this array is now an easy task.

Hopefully.

So dogs.forEach

then the callback function

and one more time,

we need actually the current element and also the index.

And that's because here is the number.

So dog number one and it's going to go all the way to seven.

And so, let's check out our rule.

So, a dog is an adult if he is at least three years old.

So if dog is greater equal three,

then log a string like this.

So here is the index plus one.

Here goes the dog itself

and then else

is still a puppy.

And here we need just this.

And, I think, with this we are good.

Just remove this.

And yes, dog number one is five years old,

so it's still an adult.

Number two is two years old, so still a puppy.

This is again a puppy with one year old

and so, yeah, that's the correct solution.

Now let's just do it for this test data here.

Gonna duplicate this one.

Let's just comment out the first one

and okay, here we only have one puppy

which is the one before the last.

And so this one is correct as well.

And so, challenge completed.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.