From d2daeb237b1cd6cd6f4f9cf2d0c1b82003622f80 Mon Sep 17 00:00:00 2001 From: ENG ZAKARIA Date: Tue, 3 Jun 2025 17:17:07 +0300 Subject: [PATCH] waa --- array_challenges.js | 15 +++++++++++++- dom_challenges.js | 48 ++++++++++++++++++++++++++++++++++++++++----- htmlstructure.html | 9 ++++++++- index.html | 10 ++++++++++ 4 files changed, 75 insertions(+), 7 deletions(-) diff --git a/array_challenges.js b/array_challenges.js index 3e3c564..c0aacd5 100644 --- a/array_challenges.js +++ b/array_challenges.js @@ -34,7 +34,7 @@ const movies = [ 2. Log the resulting array. Expected Output: - [ + [t "Fast & Furious 10 - Rating: 7.5/10", "The Notebook - Rating: 8.0/10", "Spider-Man: No Way Home - Rating: 8.7/10", @@ -45,6 +45,13 @@ const movies = [ */ // ✍️ Solve it here ✍️ +console.log(77) + + const newarray= movies.map((movetitle)=>{ + return`${movetitle.title} rating ${movetitle.rating} /10` + }) + + console.log(newarray) /* @@ -67,5 +74,11 @@ const movies = [ // ✍️ Solve it here ✍️ + const movies2= movies.filter((item)=>{ + if(item.rating>=8.0){ + return item + } + }) + console.log(movies2) \ No newline at end of file diff --git a/dom_challenges.js b/dom_challenges.js index bb943d5..9e998c1 100644 --- a/dom_challenges.js +++ b/dom_challenges.js @@ -1,5 +1,5 @@ -// News articles data organized by category +// // News articles data organized by category export const newsData = { 'Latest News': [ { @@ -126,35 +126,73 @@ export function displayArticles(category) { const articles = newsData[category]; // 1. Clear previous content + + const newsgrid=document.querySelector(".news-grid") + newsgrid.innerHTML=""; + + // 2. Create container elements + + const featuredArticle=document.createElement("div") + featuredArticle.className="featured-article" // 3. Create article element + + const featured=document.createElement("article") + + featured.className="news-card featured" // 4. Create and setup image - + const articleimg=document.createElement("img") + articleimg.src=articles.img; + articleimg.alt=articles.title; + articleimg.className="news-image" // 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" // 7. Create title + const heading=document.createElement("h2") + heading.className="news-title" + // 8. Create date + + const seconddiv=document.createElement("div") + seconddiv.className="news-date" // 9. Create excerpt + const pragraph=document.createElement("p") + pragraph.className="news-excerpt" // 10. Create tag - + const span = document.createElement("span"); +span.className = "tag"; + // 11. Assemble the elements + content.appendChild(label); +content.appendChild(heading); +content.appendChild(seconddiv); +content.appendChild(pragraph); +content.appendChild(span); +featured.appendChild(articleimg); +featured.appendChild(content); +featuredArticle.appendChild(featured); +newsgrid.appendChild(featuredArticle); newsContainer.insertBefore(featuredArticle, newsContainer.firstChild); } - +console.log("dommm") // DO NOT CHANGE THIS document.addEventListener('DOMContentLoaded', () => { const defaultCategory = 'Latest News'; // Define the default category displayArticles(defaultCategory); // Display articles for the default category document.querySelector(`.nav-links a[data-category="${defaultCategory}"]`).classList.add('active'); // Set active class -}); \ No newline at end of file +}); diff --git a/htmlstructure.html b/htmlstructure.html index ff721c2..ec7ea0a 100644 --- a/htmlstructure.html +++ b/htmlstructure.html @@ -1,3 +1,4 @@ +
+ - \ No newline at end of file + +https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTqJJmhTk2LmKYL8HVIL9Kmccu3wRWZ7IhcYQ&s + + + +https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ8EX-GJpVk0Hy-9Z_3HSlGAr-Ow_w6imOXhg&s \ No newline at end of file diff --git a/index.html b/index.html index fda5eb7..00ba701 100644 --- a/index.html +++ b/index.html @@ -6,8 +6,10 @@ Gabi News - Latest Technology Updates + +
@@ -36,6 +38,7 @@
+
+ + + \ No newline at end of file