diff --git a/array.html b/array.html new file mode 100644 index 0000000..ea0a49d --- /dev/null +++ b/array.html @@ -0,0 +1,11 @@ + + + + + + +

array challanges

+ + + + \ No newline at end of file diff --git a/array_challenges.js b/array_challenges.js index 3e3c564..65a854e 100644 --- a/array_challenges.js +++ b/array_challenges.js @@ -45,8 +45,10 @@ const movies = [ */ // ✍️ Solve it here ✍️ - - + const mappedMovie = movies.map((result) => { +return{'title': result.title, 'rating': result.rating } + } ) + console.log(mappedMovie) /* Task 2: Find Highly Rated Movies 🌟 (`.filter`) @@ -67,5 +69,10 @@ const movies = [ // ✍️ Solve it here ✍️ +const filterMovie = movies.filter((answer) => { + if (answer.rating >= 8.0) { - \ No newline at end of file + +return answer.rating } +}) + console.log(filterMovie) \ No newline at end of file diff --git a/dom_challenges.js b/dom_challenges.js index 1f414b8..187b778 100644 --- a/dom_challenges.js +++ b/dom_challenges.js @@ -158,32 +158,55 @@ export function displayArticles(category, featuredArticle = null) { const article = featuredArticle || articles[0]; // 1. Clear previous content - +newsContainer.innerHTML=""; // 2. Create container elements - +const containerElement = document.createElement("div") +containerElement.className = "featured-article" // 3. Create article element - +const articleElement = document.createElement("article") +articleElement.className = "news-card featured" // 4. Create and setup image - +const imageElement = document.createElement("img") +imageElement.className = "news-image" +imageElement.src = article.image; +imageElement.alt = article.title; // 5. Create content container - +const contentContainer = document.createElement("div") +contentContainer.className = "news-content" // 6. Create featured label - +const featuredLabel = document.createElement("span") +featuredLabel.className = "featured-label" // 7. Create title - +const titleElement = document.createElement("h2") +titleElement.className = "news-title" +titleElement.textContent = article.title // 8. Create date - +const Date = document.createElement("div") +Date.className = "news-date" +Date.textContent = article.date; // 9. Create excerpt - +const Excerpt = document.createElement("p") +Excerpt.classname = "news-exerpt" +Excerpt.textContent = article.excerpt; // 10. Create tag - +const Tag = document.createElement("span") +Tag.className = "tag" +Tag.textContent = article.tag; // 11. Assemble the elements - + containerElement.append(articleElement) + containerElement.append(imageElement) + containerElement.append(contentContainer) + containerElement.append(featuredLabel) + containerElement.append(titleElement) + containerElement.append(Date) + containerElement.append(Excerpt) + containerElement.append(Tag) // 12. Append the article container to the news container - +newsContainer.append(containerElement) +return newsContainer; } // DO NOT CHANGE THIS diff --git a/index.html b/index.html index 6a59a72..e08eae1 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,7 @@ +
@@ -84,7 +85,7 @@

${article.title}

SpaceX Successfully Launches New Satellite Constellation + alt="SpaceX Successfully Launches New Satellite Constellation"/>

SpaceX Successfully Launches New Satellite Constellation

March 13, 2024
@@ -96,7 +97,7 @@

SpaceX Successfully Launches New Satellite Constellation<
Apple Unveils Revolutionary Mixed Reality Device + alt="Apple Unveils Revolutionary Mixed Reality Device"/>

Apple Unveils Revolutionary Mixed Reality Device

March 12, 2024