MCPcopy Create free account
hub / github.com/CodeWithHarry/Sigma-Web-Dev-Course / createCard

Function createCard

Video 77/script.js:1–26  ·  view source on GitHub ↗
(title, cName, views, monthsOld, duration, thumbnail)

Source from the content-addressed store, hash-verified

1function createCard(title, cName, views, monthsOld, duration, thumbnail) {
2 // Finish this function
3 let viewStr
4 if (views < 1000) {
5 viewStr = views;
6 }
7 else if (views > 1000000) {
8 viewStr = views / 1000000 + "M";
9 }
10 else {
11 viewStr = views / 1000 + "K";
12 }
13 let html = `<div class="card">
14 <div class="image">
15 <img src="${thumbnail}"
16 alt="">
17 <div class="capsule">${duration}</div>
18 </div>
19 <div class="text">
20 <h1>${title}</h1>
21 <p>${cName} . ${viewStr} views . ${monthsOld} months ago</p>
22 </div>
23</div>`
24
25 document.querySelector(".container").innerHTML = document.querySelector(".container").innerHTML + html
26}
27
28
29createCard("Introduction to Backend | Sigma Web Dev video #2", "CodeWithHarry", 560000, 7, "31:22", "https://i.ytimg.com/vi/tVzUXW6siu0/hqdefault.jpg?sqp=-oaymwEcCPYBEIoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLACwWOixJVrKLFindK92kYMgTcQbw")

Callers 1

script.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected