All language subtitles for 041 Challenge 20_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,300 --> 00:00:00,540 All right. 2 00:00:00,540 --> 00:00:07,590 So here comes Challenge 20. Currently on our home page it's quite cluttered because every single blog post 3 00:00:07,680 --> 00:00:11,310 no matter how long it is one paragraph or five paragraphs, 4 00:00:11,340 --> 00:00:13,210 it all gets listed here. 5 00:00:13,500 --> 00:00:18,960 But now that we've managed to create a separate page for each and every single one of our blog posts 6 00:00:19,290 --> 00:00:23,100 we don't want to list it in full on our home page anymore. 7 00:00:23,550 --> 00:00:29,940 The goal of this challenge is to use Google and use Stack Overflow and use all the resources you have 8 00:00:29,940 --> 00:00:38,910 on the Internet to figure out how you can change the code so that our home page now truncates the content 9 00:00:39,030 --> 00:00:45,790 of each blog posts to only 100 characters. And then at the end there's just these three ... 10 00:00:46,140 --> 00:00:51,690 and now we only have a preview of each blog post. 11 00:00:51,690 --> 00:00:57,750 Pause the video and I want you to practice this really truly important programming skill of figuring 12 00:00:57,750 --> 00:01:02,060 things out by yourself and try to complete this challenge. 13 00:01:03,180 --> 00:01:06,390 So here's my first hint for you. 14 00:01:06,390 --> 00:01:09,920 A journey of a thousand miles starts with a single step. 15 00:01:10,030 --> 00:01:16,200 The programmer version of that is that the journey of solving any programming problem starts with a single 16 00:01:16,200 --> 00:01:16,880 search. 17 00:01:16,890 --> 00:01:22,380 So let's go ahead and try to succinctly explain to Google what it is that we want to know. 18 00:01:22,800 --> 00:01:30,360 Now the goal that we want to achieve is to be able to truncate our string down to 100 characters using 19 00:01:30,480 --> 00:01:31,360 Javascript. 20 00:01:31,440 --> 00:01:37,110 So if we exclude all of the specific parts of our problem say the 100 characters right? Because somebody 21 00:01:37,110 --> 00:01:40,800 else might have posted that they wanted to limit it to 10 characters. 22 00:01:40,890 --> 00:01:43,490 So to widen our search let's try something like 23 00:01:43,500 --> 00:01:50,030 truncate string Javascript. And the first answer we get on Stack Overflow 24 00:01:50,040 --> 00:01:50,890 let's check it out. 25 00:01:50,970 --> 00:01:54,290 Let's see what that query is to see if it matches our own. 26 00:01:54,300 --> 00:02:01,110 So they want to truncate a dynamically loaded string using straight Javascript and all they care about 27 00:02:01,170 --> 00:02:02,790 is just the number of characters. 28 00:02:02,820 --> 00:02:05,640 That sounds exactly like what we want to do as well. 29 00:02:05,640 --> 00:02:11,550 And the answer they explain is to use the substring method and they actually very kindly link to the 30 00:02:11,550 --> 00:02:15,140 documentation as well as providing a code example. 31 00:02:15,180 --> 00:02:23,040 So let's say that you have a string ABCDEFG and you want to truncate it down to say only 3 characters 32 00:02:23,040 --> 00:02:26,290 long. Then you would say the string 33 00:02:26,290 --> 00:02:33,720 call a method .substring on it and then inside the parentheses you specify a start position and an 34 00:02:33,720 --> 00:02:37,090 end position where you want to cut up that string. 35 00:02:37,120 --> 00:02:45,190 So now the outcome of my truncated string is now just ABC because it goes from 0 to length which is 3. 36 00:02:45,190 --> 00:02:51,390 So from 0 to 3 then then that includes 0, 1, 2, 3 only has ABC right? 37 00:02:51,460 --> 00:02:53,270 So now using this 38 00:02:53,380 --> 00:02:56,930 can you apply it to the challenge and solve it for yourself? 3976

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