All language subtitles for 041 Challenge 20_en

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
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
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

All right.

So here comes Challenge 20. Currently on our home page it's quite cluttered because every single blog post

no matter how long it is one paragraph or five paragraphs,

it all gets listed here.

But now that we've managed to create a separate page for each and every single one of our blog posts

we don't want to list it in full on our home page anymore.

The goal of this challenge is to use Google and use Stack Overflow and use all the resources you have

on the Internet to figure out how you can change the code so that our home page now truncates the content

of each blog posts to only 100 characters. And then at the end there's just these three ...

and now we only have a preview of each blog post.

Pause the video and I want you to practice this really truly important programming skill of figuring

things out by yourself and try to complete this challenge.

So here's my first hint for you.

A journey of a thousand miles starts with a single step.

The programmer version of that is that the journey of solving any programming problem starts with a single

search.

So let's go ahead and try to succinctly explain to Google what it is that we want to know.

Now the goal that we want to achieve is to be able to truncate our string down to 100 characters using

Javascript.

So if we exclude all of the specific parts of our problem say the 100 characters right? Because somebody

else might have posted that they wanted to limit it to 10 characters.

So to widen our search let's try something like

truncate string Javascript. And the first answer we get on Stack Overflow

let's check it out.

Let's see what that query is to see if it matches our own.

So they want to truncate a dynamically loaded string using straight Javascript and all they care about

is just the number of characters.

That sounds exactly like what we want to do as well.

And the answer they explain is to use the substring method and they actually very kindly link to the

documentation as well as providing a code example.

So let's say that you have a string ABCDEFG and you want to truncate it down to say only 3 characters

long. Then you would say the string

call a method .substring on it and then inside the parentheses you specify a start position and an

end position where you want to cut up that string.

So now the outcome of my truncated string is now just ABC because it goes from 0 to length which is 3.

So from 0 to 3 then then that includes 0, 1, 2, 3 only has ABC right?

So now using this

can you apply it to the challenge and solve it for yourself?

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