Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,650 --> 00:00:07,830
Alright. Onwards and upwards. Challenge 12. In order to complete this challenge the first thing I need you to do
2
00:00:07,950 --> 00:00:15,000
is to delete this console log inside our app.js. Make sure that there's no other log statements inside
3
00:00:15,000 --> 00:00:23,460
this file other than inside our app.listen because instead of logging the posts inside here, I want you
4
00:00:23,460 --> 00:00:26,200
to be able to pass it over to our home.
5
00:00:26,370 --> 00:00:27,140
ejs
6
00:00:27,300 --> 00:00:30,060
and log it from here instead.
7
00:00:30,480 --> 00:00:35,520
There's a couple of steps to this and you might have to think about it but this is the end outcome. You
8
00:00:35,520 --> 00:00:38,790
want to be able to log exactly the same thing, the post array,
9
00:00:38,790 --> 00:00:44,930
but this time inside the home.ejs. Pause the video, give it a think and give it a go.
10
00:00:46,880 --> 00:00:47,140
All right.
11
00:00:47,150 --> 00:00:49,400
Here's my first hint.
12
00:00:49,400 --> 00:00:52,110
Remember that using res.render
13
00:00:52,130 --> 00:00:58,490
the second parameter that we're passing in to this function is essentially a Javascript object. And we've
14
00:00:58,490 --> 00:01:03,860
already seen what Javascript objects look like and we know that you can have more than one key value
15
00:01:03,860 --> 00:01:08,180
pair as long as you simply just add a comma in between them.
16
00:01:08,180 --> 00:01:15,800
So instead of simply just passing over the starting content, we also want to pass over the posts array
17
00:01:16,190 --> 00:01:18,810
using this res.render method.
18
00:01:18,860 --> 00:01:23,730
So pause the video and see if that was enough of a hint to complete the challenge.
19
00:01:23,790 --> 00:01:24,230
All right.
20
00:01:24,230 --> 00:01:26,940
Here comes hint number 2.
21
00:01:26,960 --> 00:01:33,210
If you look at the EJS docs you know that there's a whole bunch of different tags that we can use.
22
00:01:33,470 --> 00:01:39,770
And the one that we've shown you before is the scriptlet tag which allows you to write Javascript inside
23
00:01:39,770 --> 00:01:41,110
the EJS file.
24
00:01:41,360 --> 00:01:47,990
With that in mind you should be able to complete the challenge and log the posts array from within the
25
00:01:47,990 --> 00:01:52,590
home.ejs file. Pause the video and complete the challenge.
2553
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.