oppgave om arrays
This commit is contained in:
parent
9350cc3efb
commit
c7208b5d99
2 changed files with 112 additions and 0 deletions
38
oppgaver/uke5/array1.html
Normal file
38
oppgaver/uke5/array1.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
<script>
|
||||
const app = document.getElementById('app');
|
||||
const pocketStuff = ['Hat', 'Pencil', ];
|
||||
|
||||
view();
|
||||
function view() {
|
||||
let html = '';
|
||||
html += /*HTML*/ `
|
||||
<button onclick="seeWhatsInPocket()">
|
||||
See what is in the pockets!
|
||||
</button>
|
||||
`;
|
||||
app.innerHTML = html;
|
||||
}
|
||||
|
||||
// controller
|
||||
function seeWhatsInPocket(){
|
||||
for (i = 0; i < pocketStuff.lenght; i++){
|
||||
console.log(i);
|
||||
app.innerHTML += /*HTML*/ `
|
||||
<li>${pocketStuff[i]}</li>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue