Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Ali haider js2 week 2 #82

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
exercise 1 and 2 completed
  • Loading branch information
AliHaider-1 committed Aug 23, 2020
commit fb03ee379ba35a07969a84ba6d0f7d4acb1c6f89
17 changes: 17 additions & 0 deletions Week-2/Homework/mandatory/2-exercises/exercises.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
*/
function exerciseOne(arrayOfPeople) {
let content = document.querySelector("#content");
for(var i=0;i<arrayOfPeople.length;i++){
var heading1 = document.createElement("h1");
heading1.textContent="Name: "+people[i].name;
content.append(heading1);
var heading2 = document.createElement("h2");
heading2.textContent = "Job: "+people[i].job;
content.append(heading2);

}
}

/**
Expand All @@ -26,6 +35,14 @@ function exerciseOne(arrayOfPeople) {
*/
function exerciseTwo(shopping) {
//Write your code in here
let content = document.querySelector("#content")
var shoppingList = document.createElement("ul");
for(var i=0;i<shopping.length;i++){
var li = document.createElement("li");
li.textContent = shopping[i];
shoppingList.appendChild(li);
}
content.append(shoppingList);
}

/**
Expand Down