-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
30 lines (26 loc) · 900 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function createCard(title, cName, views, monthsOld, duration, thumbnail) {
// Finish this function
let viewStr
if (views < 1000) {
viewStr = views;
}
else if (views >= 1000000) {
viewStr = views / 1000000 + "M";
}
else {
viewStr = views / 1000 + "K";
}
let html = `<div class="card">
<div class="image">
<img src="${thumbnail}"
alt="video thumbnail here">
<div class="capsule">${duration}</div>
</div>
<div class="text">
<h1>${title}</h1>
<p>${cName} . ${viewStr} views . ${monthsOld} months ago</p>
</div>
</div>`
document.querySelector(".container").innerHTML = document.querySelector(".container").innerHTML + html
}
createCard("Dynamic Website Builder|Web Development 2 ", "VanshikaAggarwal", 560000, 7, "31:22", "tthumbnailImage.jpeg")