All language subtitles for 023 Challenge 11_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,290 --> 00:00:02,950 Are you ready for challenge 11? 2 00:00:03,210 --> 00:00:12,540 Now in this challenge I want you to put this newly created post object inside a global variable called 3 00:00:12,750 --> 00:00:15,780 posts, with an 's' at the end. 4 00:00:15,790 --> 00:00:22,590 We're going to have an array that is going to store all of these new posts but it's going to be a global 5 00:00:22,590 --> 00:00:23,800 variable. 6 00:00:23,880 --> 00:00:30,000 You need to create a new empty array that is a global variable and then you're going to add this new 7 00:00:30,000 --> 00:00:32,670 post object to that new array. 8 00:00:33,000 --> 00:00:41,160 And finally at the end of this route you're going to redirect to the root route. And inside the 9 00:00:41,160 --> 00:00:48,570 root route we're going to log all of the posts inside the post array that you created. 10 00:00:48,660 --> 00:00:56,190 Once you've completed this, what should happen is I should be able to put in a post hit publish 11 00:00:56,340 --> 00:01:04,500 and then let's go back to compose again and let's put in another post and hit publish. 12 00:01:04,650 --> 00:01:10,420 And firstly you notice that we get directed to the root route or the home page 13 00:01:10,530 --> 00:01:18,390 once we've finished composing the post. And then if you take a look inside our terminal you can see that 14 00:01:18,390 --> 00:01:20,850 my entire array is being logged 15 00:01:21,060 --> 00:01:27,540 and the first time it only contained a single object, the 'Day 1 post, and the second time this array 16 00:01:27,540 --> 00:01:33,690 contained two Javascript objects both of my posts, 'Day 1' and 'Day 2'. 17 00:01:33,900 --> 00:01:42,730 This is the end goal of this challenge and it's time to pause the video and tackle this challenge. 18 00:01:42,740 --> 00:01:44,380 All right so here's my first hint. 19 00:01:45,260 --> 00:01:53,360 What we want to do is to be able to save this post object into an array which we can then log inside this home 20 00:01:53,360 --> 00:01:54,410 route. 21 00:01:54,530 --> 00:01:58,290 Now in order to do that we need a global variable. 22 00:01:58,490 --> 00:02:04,850 Remember that global variables have to be declared outside of all of the other functions in the page. 23 00:02:05,060 --> 00:02:08,940 So that means you probably have to do it somewhere up here 24 00:02:09,080 --> 00:02:13,610 outside of all of the other functions and routes. 25 00:02:13,650 --> 00:02:18,360 All right so here's hint number 2. In order to create an empty array 26 00:02:18,540 --> 00:02:21,480 you will need to write something like this. 27 00:02:21,480 --> 00:02:28,260 Let's say that we were creating a global var variable and we call it posts and then we would create an 28 00:02:28,290 --> 00:02:34,950 empty array and assign it to this variable by saying = 29 00:02:34,980 --> 00:02:42,180 [ ] ; and this would be an empty array that has nothing inside until we add something 30 00:02:42,180 --> 00:02:42,740 to it. 31 00:02:44,840 --> 00:02:53,750 All right so now this is my final hint and that is in order to move from the app.post to the apt.get 32 00:02:53,810 --> 00:03:01,370 we're going to need to use something called res.redirect. And this is a method that allows you 33 00:03:01,370 --> 00:03:04,100 to redirect to another route, 34 00:03:04,160 --> 00:03:10,640 so essentially make a get request on any of the other routes. And if you wanted to redirect and inside 35 00:03:10,760 --> 00:03:15,830 the parentheses you would put the route that you want to redirect to. 36 00:03:15,860 --> 00:03:20,730 Those are all of my hints and see if now you can complete this challenge successfully. 3892

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