Created
May 31, 2022 20:02
-
-
Save beardedtim/d757aef0147da5a1a54df00b047b3d9e to your computer and use it in GitHub Desktop.
html stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> | |
</style> | |
</head> | |
<body> | |
<div id="app"> | |
</div> | |
</body> | |
</html> | |
<script> | |
/** | |
* I have a friends list | |
*/ | |
const friends = [ | |
{ | |
name: "Dave Smalls", | |
gender: "M" | |
}, | |
{ | |
name: "Sally Sue", | |
gender: "F" | |
}, | |
{ | |
name: "Fred Myers", | |
gender: "fuck your norms" | |
} | |
] | |
let str = '' | |
for (let i = 0; i < friends.length ; i++) { | |
const friend = friends[i] | |
str += ` | |
<div class="friend"> | |
<h2>${friend.name}</h2> | |
<h5>${friend.gender}</h5> | |
</div> | |
` | |
} | |
/** | |
* Put all friends in DOM | |
*/ | |
const app = document.getElementById('app') | |
app.innerHTML = str | |
app.innerHTML += `foobar` | |
/** | |
* Print all female friends names | |
*/ | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment