diff --git a/Week1/homework/homework/app.js b/Week1/homework/homework/app.js new file mode 100644 index 000000000..7db422686 --- /dev/null +++ b/Week1/homework/homework/app.js @@ -0,0 +1,140 @@ +'use strict'; +{ + const bookTitles = ["zakerat_jasad","alasoad_yaliq_beke","kabo_alabaseen","hokol_aldam","yakfik_khalb_wahed","ant_li","shifret_divinchi","ontha_abria","alf_lila_wlila","ghoyom" + ]; + +const bookInfo = { + "zakerat_jasad":{ + "title":"Zakerat Jasad", + "language":"Arabic", + "auther":"Ahlam Mostaghanmi" + }, + "alasoad_yaliq_beke":{ + "title":"Alasoad Yaliq Beke", + "language":"Arabic", + "auther":"Ahlam Mostaghanmi" + }, + "kabo_alabaseen":{ + "title":"Kabo Alabaseen", + "language":"Arabic", + "auther":"Haifaa Bitar" + }, + "hokol_aldam":{ + "title":"Hokol Aldam", + "language":"Arabic", + "auther":"Khathren" + }, + "yakfik_khalb_wahed":{ + "title":"Yakfik Khalb Wahed", + "language":"Arabic", + "auther":"Haifaa Bitar" + }, + "ant_li":{ + "title":"Ant Li", + "language":"Arabic", + "auther":"Ahlam Mostaghanmi" + }, + "shifret_divinchi":{ + "title":"Shifret Divinchi", + "language":"Arabic", + "auther":"Dan Broun" + }, + "ontha_abria":{ + "title":"Ontha Abria", + "language":"Arabic", + "auther":"Ahlam Mostaghanmi" + }, + "alf_lila_wlila":{ + "title":"Alf Lila Wlila", + "language":"Arabic", + "auther":"Ahlam" + }, + "Nsian":{ + "title":"Ghoyom", + "language":"Arabic", + "auther":"Ahlam Mostaghanmi" + } + +} +let bookCovers = {"zakerat_jasad":"./img/IMG_2596.JPG", +"alasoad_yaliq_beke":"./img/IMG_2591.png", +"kabo_alabaseen":"./img/IMG_2592.JPG", +"hokol_aldam":"./img/IMG_2593.png", +"yakfik_khalb_wahed":"./img/IMG_2594.JPG", +"ant_li":"./img/IMG_2595.JPG", +"shifret_divinchi":"./img/IMG_2597.JPG", +"ontha_abria":"./img/IMG_2598.JPG", +"alf_lila_wlila":"./img/IMG_2599.JPG", +"Nsian":"./img/gh.jpg" +} + + + + // Replace with you own code + // function createBookList(books){ + + // let list = document.createElement("UL"); + // document.body.appendChild(list) ; + // list.setAttribute("id","book_list"); + // for(let i = 0; i < books.length; i++){ + // let li = document.createElement("LI"); + // let title = document.createTextNode(books[i]); + // li.appendChild(title); + // list.appendChild(li); + + // } + + // } + + function createBookList(books){ + + let list = document.createElement("UL"); + document.body.appendChild(list) ; + list.setAttribute("id","book_list"); + for(let i in books){ + let li = document.createElement("LI"); + li.setAttribute("ID",i); + let header = document.createElement("H1"); + let headerText = document.createTextNode(books[i].title) + header.appendChild(headerText); + + let language = document.createElement("P"); + let languageText = document.createTextNode(books[i].language); + language.appendChild(languageText); + + + let auther = document.createElement("P"); + let autherText = document.createTextNode(books[i].auther); + auther.appendChild(autherText); + li.appendChild(header); + li.appendChild(language); + li.appendChild(auther); + list.appendChild(li); + + } + + } + + createBookList(bookInfo); + + + + function covering (covers){ + let coversArray = Object.keys(covers); + console.log(coversArray); + for (let i = 0; i < coversArray.length; i++){ + let img = document.createElement("IMG"); + img.setAttribute("src",covers[coversArray[i]]); + document.getElementById(coversArray[i]).appendChild(img); + console.log(coversArray[i]); + } + + + } + + + + +covering(bookCovers); +console.log(bookCovers); + } diff --git a/Week1/homework/homework/img/IMG_2591.PNG b/Week1/homework/homework/img/IMG_2591.PNG new file mode 100644 index 000000000..b141c4007 Binary files /dev/null and b/Week1/homework/homework/img/IMG_2591.PNG differ diff --git a/Week1/homework/homework/img/IMG_2592.JPG b/Week1/homework/homework/img/IMG_2592.JPG new file mode 100644 index 000000000..d9ed4b312 Binary files /dev/null and b/Week1/homework/homework/img/IMG_2592.JPG differ diff --git a/Week1/homework/homework/img/IMG_2593.PNG b/Week1/homework/homework/img/IMG_2593.PNG new file mode 100644 index 000000000..f47ea4fe6 Binary files /dev/null and b/Week1/homework/homework/img/IMG_2593.PNG differ diff --git a/Week1/homework/homework/img/IMG_2594.JPG b/Week1/homework/homework/img/IMG_2594.JPG new file mode 100644 index 000000000..9d34d4f2c Binary files /dev/null and b/Week1/homework/homework/img/IMG_2594.JPG differ diff --git a/Week1/homework/homework/img/IMG_2595.JPG b/Week1/homework/homework/img/IMG_2595.JPG new file mode 100644 index 000000000..2a91c0054 Binary files /dev/null and b/Week1/homework/homework/img/IMG_2595.JPG differ diff --git a/Week1/homework/homework/img/IMG_2596.JPG b/Week1/homework/homework/img/IMG_2596.JPG new file mode 100644 index 000000000..eed903038 Binary files /dev/null and b/Week1/homework/homework/img/IMG_2596.JPG differ diff --git a/Week1/homework/homework/img/IMG_2597.JPG b/Week1/homework/homework/img/IMG_2597.JPG new file mode 100644 index 000000000..e2a11f76a Binary files /dev/null and b/Week1/homework/homework/img/IMG_2597.JPG differ diff --git a/Week1/homework/homework/img/IMG_2598.JPG b/Week1/homework/homework/img/IMG_2598.JPG new file mode 100644 index 000000000..803a6d77e Binary files /dev/null and b/Week1/homework/homework/img/IMG_2598.JPG differ diff --git a/Week1/homework/homework/img/IMG_2599.JPG b/Week1/homework/homework/img/IMG_2599.JPG new file mode 100644 index 000000000..8e3412d34 Binary files /dev/null and b/Week1/homework/homework/img/IMG_2599.JPG differ diff --git a/Week1/homework/homework/img/gh.jpg b/Week1/homework/homework/img/gh.jpg new file mode 100644 index 000000000..aaf3a4ea5 Binary files /dev/null and b/Week1/homework/homework/img/gh.jpg differ diff --git a/Week1/homework/homework/index.html b/Week1/homework/homework/index.html new file mode 100644 index 000000000..cc80bd0eb --- /dev/null +++ b/Week1/homework/homework/index.html @@ -0,0 +1,17 @@ + + + + + + + + + + Document + + + + + + + \ No newline at end of file diff --git a/Week1/homework/homework/style.css b/Week1/homework/homework/style.css new file mode 100644 index 000000000..348ca3b9d --- /dev/null +++ b/Week1/homework/homework/style.css @@ -0,0 +1,38 @@ +/* add your styling here */ + +body{ + display:block; + width:100%; + margin-left:0px; + + + +} +ul { + display:flex; + flex-wrap: wrap; + flex-direction: row; + width: 100%; + list-style-type: none; + + + + +} +h1{ + font-size: 20px; +} +p{ + font-size: 15px; +} +li{ + width: 30%; + margin: 5px; + padding: 10px; + background-color: rgb(152, 230, 28); + +} +img{ + width:100%; + +} \ No newline at end of file diff --git a/Week3/homework/step4-bonus.js b/Week3/homework/step4-bonus.js index 4e89b29e7..93ed68dbb 100644 --- a/Week3/homework/step4-bonus.js +++ b/Week3/homework/step4-bonus.js @@ -3,8 +3,17 @@ const values = ['a', 'b', 'c', 'd', 'a', 'e', 'f', 'c']; // Add your function here. Try and come up with a good name for this function +uniqueArray = values.filter(function duplicateRemover (item, pos) { + return values.indexOf(item) == pos; +}) +console.log(uniqueArray); // Replace `yourFunction` with the name of the function you just created -const uniqueValues = yourFunction(values); +const uniqueValues = duplicateRemover(values); console.log(uniqueValues); + +//another solution + +[... new Set(values)]; +console.log([... new Set(values)]); diff --git a/Week3/homework/step4.js b/Week3/homework/step4.js index e38d43447..0b9859b9d 100644 --- a/Week3/homework/step4.js +++ b/Week3/homework/step4.js @@ -1,8 +1,16 @@ 'use strict'; // Add your code here +function createBase(x) { + return function (z) { + sum = x + z; + return sum; + } + } + const addSix = createBase(6); -const addSix = createBase(6); + console.log(addSix(10)); + console.log(addSix(21)); addSix(10); // returns 16 addSix(21); // returns 27