current work

This commit is contained in:
2024-09-17 14:41:00 -05:00
commit fa7ac2949b
13 changed files with 183 additions and 0 deletions

13
4/cointoss.html Normal file
View File

@@ -0,0 +1,13 @@
<html><body><script>
let coin = 0
coin = Math.random()
console.log(coin)
if (coin >= .5){
console.log("tails")
}
if (coin < .5){
console.log("heads")
}
</script></body></html>

7
4/forarray.html Normal file
View File

@@ -0,0 +1,7 @@
<html><body><script> let colors = ["Red", "Green", "Blue"]; for (let [index, item] of colors.entries()) {
console.log(`${index}: ${item} is a color.`);
}
</script></body></html>

9
4/forof.html Normal file
View File

@@ -0,0 +1,9 @@
<html><body><script>
let colors = ["Red", "Green", "Blue"]; for (let color of colors) {
console.log(`${color} is a color.`);
}
</script></body></html>

12
4/if.html Normal file
View File

@@ -0,0 +1,12 @@
<html>
<body>
<script> let speed = 30;
console.log(`Your current speed is ${speed} mph.`);
if (speed > 25) {
console.log("Slow down!");
}
</script></body></html>

17
4/ifelse.html Normal file
View File

@@ -0,0 +1,17 @@
<html><body><script>
let speed = 20;
console.log(`Your current speed is ${speed} mph.`);
if (speed > 25) {
console.log("Slow down!");
} else {
console.log("You're obeying the speed limit.");
}
</script></body></html>

8
4/jonarrayforof.html Normal file
View File

@@ -0,0 +1,8 @@
<html>
<body>
<script>
let name = "jonathan"
for (let [a, letter] of name.split("").entries()){
console.log(`${a} ${letter}`)
}
</script></body></html>

8
4/jonathanarrayfor.html Normal file
View File

@@ -0,0 +1,8 @@
<html>
<body>
<script>
let name = "Branan"
for (let [i, letter] of name.split("").entries()){
console.log(`${i} ${letter}`)
}
</script></body></html>

11
4/sayhello.html Normal file
View File

@@ -0,0 +1,11 @@
<html><body><script>
function sayHello(name){
return `Hello ${name}, it is good to see you.`
}
let a = sayHello("jon".toLocaleUpperCase())
console.log(a)
// sayHello("meli")
// sayHello("sammie")
// sayHello("lucy")
</script></body></html>

11
4/while.html Normal file
View File

@@ -0,0 +1,11 @@
<html>
<body>
<script>
let speed = 50;
while (speed > 25) {
console.log(`Your current speed is ${speed} mph.`);
speed--;
}
console.log(`Now your speed is ${speed} mph.`);
</script></body></html>