All language subtitles for 026 Challenge 12 Solution_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
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 Download
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
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
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
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-PT Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,260 --> 00:00:03,120 All right. So here's the answer to challenge 2 00:00:03,120 --> 00:00:11,710 12. We've deleted the console log inside our root route and instead we want to be able to log this array 3 00:00:11,710 --> 00:00:19,550 called posts inside our home.ejs so that when we create a new post through the compose page then 4 00:00:19,640 --> 00:00:25,670 once we get back onto the home page, we should be able to log that new post as well as any others that 5 00:00:25,670 --> 00:00:28,750 we've created previously. In order to do this 6 00:00:28,760 --> 00:00:36,920 we first have to pass over this posts array into the home.ejs page when we render it. In order to do that 7 00:00:37,220 --> 00:00:40,320 we need to add another key value pair to this 8 00:00:40,370 --> 00:00:42,710 essentially what is a Javascript object 9 00:00:42,740 --> 00:00:43,490 right? 10 00:00:43,580 --> 00:00:45,730 Let's add a comma after that one 11 00:00:45,830 --> 00:00:49,580 and then let's add our second object. 12 00:00:49,580 --> 00:00:54,250 And I'm just going to reformat this so that you can see it a bit more clearly. 13 00:00:54,290 --> 00:00:59,480 So the first object has a key of startingContent and a value of homeStartingContent which comes from 14 00:00:59,480 --> 00:01:00,060 here. 15 00:01:00,380 --> 00:01:07,130 The second object I'm going to call posts and I'm also going to pass over the posts array which comes 16 00:01:07,130 --> 00:01:08,150 from over here. 17 00:01:08,540 --> 00:01:14,570 So that means that once I render the home.ejs page I should have access to something called posts 18 00:01:14,900 --> 00:01:21,590 which should be the array of posts that I've created so far. Inside the home.ejs, all we need to do 19 00:01:21,710 --> 00:01:32,720 is to console.og that posts array. And remember that this won't work unless we add those EJS scriptlet 20 00:01:32,870 --> 00:01:36,830 tags which look like this. 21 00:01:36,830 --> 00:01:44,120 And remember that even small things such as curly braces or just a single closing curly brace also need 22 00:01:44,120 --> 00:01:46,560 these scriptlet tags for them to work. 23 00:01:46,580 --> 00:01:53,390 So let's go ahead and wrap this line of Javascript inside some EJS scriptlet tags which is an angle 24 00:01:53,390 --> 00:01:59,680 bracket, percentage sign and then we're going to close it off with again percentage angle bracket. 25 00:01:59,930 --> 00:02:09,229 So now if we hit save and we head back to our home page and we go over to the compose screen and we 26 00:02:09,229 --> 00:02:15,710 just compose some sort of post, hit publish and we get redirected back to the home. 27 00:02:15,770 --> 00:02:20,200 ejs at which point we should have passed over that posts array. 28 00:02:20,450 --> 00:02:27,740 So now if we check our console you can see that logged in here is the same post that we composed earlier 29 00:02:27,740 --> 00:02:28,240 on 30 00:02:28,460 --> 00:02:32,650 but in this case it's actually being logged from within our home. 31 00:02:32,700 --> 00:02:33,310 ejs. 3238

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