Skip to content
Open
Show file tree
Hide file tree
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
classrum excercise 09 06 2019
  • Loading branch information
annagabain committed Jun 9, 2019
commit e34d7ab106f5f0f5e5b452ed8e9d43f907ebd284
21 changes: 19 additions & 2 deletions Week1/homework/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
'use strict';

{
const bookTitles = [
const favoriteGames = [
// Replace with your own book titles
'harry_potter_chamber_secrets',
'call_of_the_wild',
'the_turtle',
'snowball_and_the_bunny_adventures',
'chicken_little',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never played any of those games!
Need to look into it. Cool stuff 👍

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;) good luck

];

// Replace with your own code
console.log(bookTitles);
console.log(favoriteGames);
// document.body.onload = addElement;
// function displayGameTitles = () => {

let unorderedList = document.createElement("ul");
for (const gameIndex in favoriteGames) {
const listItem = document.createElement("li");
listItem.textContent = favoriteGames[gameIndex];
unorderedList.appendChild(listItem);
}
// add the newly created element and its content into the DOM
const currentDiv = document.getElementById("gameDiv");
document.body.insertBefore(unorderedList, currentDiv);

}
12 changes: 11 additions & 1 deletion Week1/homework/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
<!-- replace this with your HTML content -->
<!-- replace this with your HTML content -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>FavoriteBooks Excercise</title>
</head>
<body>
<script src="app.js"></script>
<div id = gameDiv></div>
</body>
</html>