-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
26 lines (21 loc) · 806 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
window.addEventListener("load", () => {
// This is a check to see if there's a username stored
let username = localStorage.getItem("username");
if (!username) {
// Prompt for one if a username isn't found
username = window.prompt("What is your name?");
localStorage.setItem("username", username);
}
const containerEl = document.querySelector("#newsfeed");
// This makes things appear
for (let index = bacefook.newsfeed.length - 1; index >= 0; index--) {
const post = bacefook.newsfeed[index];
const friendEl = document.createElement("div");
friendEl.className = "friend";
friendEl.innerText = post.friend;
const postEl = document.createElement("div");
postEl.innerText = post.text;
postEl.append(friendEl);
containerEl.append(postEl);
}
});