All language subtitles for 156 Coding Challenge 3.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
hu Hungarian Download
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 to Coding Challenge number three.

And this is gonna be a quick and easy one.

So all I want you to do is to rewrite

the 'calcAverageHumanAge' function

that we wrote in the previous challenge.

Now the difference here is that this time,

you should use an arrow function

and you should use chaining.

Now to make this chaining work,

just keep in mind the second way that I used

in the last challenge to calculate the average.

Then, as always, use this test data here

to try out your function.

And so I'll see you here in a minute,

or five minutes maybe, once you're done.

Now all right, so let's grab the code here

from the previous one.

So there's no need to just rewrite everything.

So let's get rid of all the comments here,

all the console.logs.

And so let's save it here,

and then rewrite it as an arrow function.

So it still takes in the ages,

and now what it returns is simply the ages,

then dot, this map,

so calculating the human ages.

Okay, and then on the result of that,

we filter for only the adult docs.

So when the age is greater than 18.

So this is what we have for now.

Let's call this one here two.

Okay. And so for now this is the two erase that we have

one for each function call.

But now let's then also calculate the average.

And so for that all we need to do is to chain

this method of calculating the average.

That he showed you in the last lecture,

or actually in the last challenge.

So pasting that here.

And so now we get the exact same results as before,

and that's actually already it.

Now what's really important to notice here,

is that this is actually really the only way

of calculating the average now.

So basically dividing the age by the length

of the current array immediately here

in each of the iteration.

So remember that in the last challenge,

I first simply added all the values together.

And then afterwards I divided it by the length of the array.

So in this case, by the length of the adults array.

However, that would not work in this case.

Because there would be no way of knowing the length

of the adults array.

So of this result here, right?

Because we haven't stored it anyway.

And so we couldn't do like this, like adults.length, right?

This wouldn't be possible

because adults here does not exist anywhere.

And therefore we need to take that length

from this input here.

So from this fourth parameter,

which gives us access to the array,

on which the method is called.

And that's the reason why I showed you this way here,

in the last lecture.

Because yeah, again this is the only way

in which we can now calculate this average,

unless we wanted to do it in two steps.

But my instruction here

was to really do it all with chaining.

And so this is the way to go then.

All right, so make sure you understand

really why and also how this one here works.

And then let's already move on to our next method,

which is gonna be defined method.

So another really cool one.

So I can't wait to see you there.

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