moved some files around

This commit is contained in:
Geir Okkenhaug Jerstad 2024-08-19 14:41:28 +02:00
parent c8446d5c93
commit 7ee0c5f323
6 changed files with 29 additions and 25 deletions

View file

@ -1,3 +1,21 @@
const square = function (x) { const square = function (x) {
return x * x; return x * x;
} }
const hummus = function (factor) {
const ingredient = function (amount, unit, name) {
let ingredientAmount = amount * factor;
if (ingredientAmount > 1) {
unit += "s";
}
console.log(`${ingredientAmount} ${unit} ${name}`);
};
ingredient(1, "can", "chickpeas");
ingredient(0.25, "cup", "tahini");
ingredient(0.25, "cup", "lemon juice");
ingredient(1, "clove", "garlic");
ingredient(2, "tablespoon", "olive oil");
ingredient(0.5, "teaspoon", "cumin");
};
hummus(10);

View file

@ -13,9 +13,6 @@
function start(){ function start(){
triangle += "#" triangle += "#"
document.getElementById('triangle').innerHTML += `<ul>${triangle}</ul>` document.getElementById('triangle').innerHTML += `<ul>${triangle}</ul>`
if (document.getElementById('triangle').innerHTML.length() == 5) {
console.log('Nice');
}
} }
</script> </script>
</body> </body>

View file

@ -69,11 +69,7 @@
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div id="head" class="bodyPart">
<button onclick="selectHead4()"></button>
<img src="img/head1.png">
<button onclick="selectHead2()"></button>
</div>
<div id="body" class="bodyPart"> <div id="body" class="bodyPart">
<button onclick="selectBody4()"></button> <button onclick="selectBody4()"></button>
<img src="img/body1.png"> <img src="img/body1.png">

View file

@ -17,6 +17,7 @@
console.log(yo, yo2); console.log(yo, yo2);
} }
console.log(yo); console.log(yo);
console.log(yo2);
} }
testScopes(); testScopes();
</script> </script>

View file

@ -36,8 +36,8 @@
<body> <body>
<div id="page"> <div id="page">
<h2 id="title">Class List</h2> <h2 id="title">Class</h2>
<p>Klikk på farge for å velge, klikk på boks eller knapp for å sette fargen</p>
<div id="farge1" class="green-bg" onclick="getColor1()">farge1</div> <div id="farge1" class="green-bg" onclick="getColor1()">farge1</div>
<div id="farge2" class="blue-bg" onclick="getColor2()">farge2</div> <div id="farge2" class="blue-bg" onclick="getColor2()">farge2</div>
<div id="farge3" class="red-bg" onclick="getcolor3()">farge3</div> <div id="farge3" class="red-bg" onclick="getcolor3()">farge3</div>
@ -54,35 +54,27 @@
console.log(farge1, farge2, farge3); console.log(farge1, farge2, farge3);
function getColor1() { function getColor1() {
farge = document.getElementById('farge1').className; farge = document.getElementById('farge1').className;
console.log(farge);
} }
function getColor2() { function getColor2() {
farge = document.getElementById('farge2').className; farge = document.getElementById('farge2').className;
console.log(farge) console.log(farge);
} }
function getcolor3() { function getcolor3() {
farge = document.getElementById('farge3').className; farge = document.getElementById('farge3').className;
console.log(farge) console.log(farge);
} }
function setColor1() { function setColor1() {
document.getElementById('box-1').classList.add(farge); document.getElementById('box-1').classList.add(farge);
console.log(farge) console.log(farge);
} }
function setColor2() { function setColor2() {
document.getElementById('box-2').classList.add(farge); document.getElementById('box-2').classList.add(farge);
console.log(farge) console.log(farge);
} }
function changeBgColor() { function changeBgColor() {
document.getElementById('page').classList.add(farge); document.getElementById('page').classList.add(farge);
} }
// paragraph.classList.add('bold', 'red-bg', 'big-font');
// paragraph.classList.remove('bold');
// paragraph.classList.replace('big-font', 'white-text');
// paragraph.classList.toggle('red-bg');
// paragraph.classList.toggle('red-bg');
// console.log(paragraph.classList.contains('red-bg'));
// console.log(paragraph.classList);
</script> </script>
</body> </body>