diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/array_challenges.js b/array_challenges.js index 3e3c564..ec2ca18 100644 --- a/array_challenges.js +++ b/array_challenges.js @@ -45,7 +45,10 @@ const movies = [ */ // ✍️ Solve it here ✍️ - + const movie=movies.map((movie) => { + return `${movie.title} - Rating: ${movie.rating}/10`; + }) + console.log(movie); /* Task 2: Find Highly Rated Movies 🌟 (`.filter`) @@ -67,5 +70,7 @@ const movies = [ // ✍️ Solve it here ✍️ - - \ No newline at end of file + const highly = movies.filter((movie) => { + return movie.rating >=8.0;}) + console.log(highly); + \ No newline at end of file diff --git a/dom_challenges.js b/dom_challenges.js index bb943d5..9c8e263 100644 --- a/dom_challenges.js +++ b/dom_challenges.js @@ -117,7 +117,19 @@ export const newsData = { } ] }; - +/*{
+ + +
}*/ // YOUR TASK: Complete this function using the html structure in the htmlstructure.html file @@ -126,26 +138,61 @@ export function displayArticles(category) { const articles = newsData[category]; // 1. Clear previous content - - // 2. Create container elements - + newsContainer.innerHTML = ''; + + // 2. Create container for featured article + const featuredArticle = document.createElement('div'); + featuredArticle.classList.add('featured-article'); + // 3. Create article element - + const article = document.createElement('article'); + article.className="news-card featured"; // kuwaan oo nkale ka dhig + // 4. Create and setup image - + const image = document.createElement("img"); + image.className="news-image"; + image.src = articles[0].image; + image.alt = articles[0].title; + // 5. Create content container - + const content = document.createElement('div'); + content.className="news-content"; + // 6. Create featured label - + const label = document.createElement('span'); + label.className="featured-label"; + label.textContent = 'Featured Story'; + // 7. Create title - + const title = document.createElement('h2'); + title.className="news-title"; + title.textContent = articles[0].title; + // 8. Create date - + const date = document.createElement('div'); + date.classNmae="news-date"; + date.textContent = articles[0].date; + // 9. Create excerpt - + const excerpt = document.createElement('p'); + excerpt.className="news-excerpt"; + excerpt.textContent = articles[0].excerpt; + // 10. Create tag - + const tag = document.createElement('span'); + tag.classNAme="tag"; + tag.textContent = articles[0].tag; + // 11. Assemble the elements + content.appendChild(label); + content.appendChild(title); + content.appendChild(date); + content.appendChild(excerpt); + content.appendChild(tag); + + article.appendChild(image); + article.appendChild(content); + featuredArticle.appendChild(article); newsContainer.insertBefore(featuredArticle, newsContainer.firstChild); diff --git a/index.html b/index.html index fda5eb7..9bf8290 100644 --- a/index.html +++ b/index.html @@ -99,5 +99,7 @@

Apple Unveils Revolutionary Mixed Reality Device

+ + \ No newline at end of file