Commit 38716a8a authored by Kevin Kaminski's avatar Kevin Kaminski

Initial commit:

parents
<html>
<head>
<title>Basic HTML !!!</title>
<script type="text/javascript">
var color = "Orange";
function myFunc() {
let color2 = "Blue";
document.write(color2);
}
let adder = (int1) => {
let total = int1;
return (int2) => {
return total + int2;
}
}
</script>
</head>
<body>
<h1>Hello, World!!</h1>
Global Variables:
<script>
document.write(color);
</script>
<br/>
Local Variable in Function:
<script>
myFunc();
</script>
<br/>
Nested Functions:
<script>
let numFunc = adder(10);
document.write(`${numFunc(12)}`)
</script>
<br/>
Switch:
<script>
let num = 0
switch(num) {
case 0:
document.write("0");
break;
case 1:
document.write("1");
break;
case 2:
document.write("2");
break;
case 3:
document.write("3");
break;
case 4:
document.write("4");
break;
case 5:
document.write("5");
break;
case 6:
document.write("6");
break;
case 7:
document.write("7");
break;
case 8:
document.write("8");
break;
case 9:
document.write("9");
break;
}
</script>
<br/>
Loops!
<script>
let arr = ["a", "b", "c", "d", "e"]
document. write("<br>")
document.write("indices: ")
for (let i in arr) {
document.write(i);
}
document. write("<br>")
document.write("values: ")
for (let i of arr) {
document.write(i);
}
document. write("<br>")
document.write("values from while: ")
let i = 0;
while (i < arr.length) {
document.write(arr[i]);
i ++
}
document. write("<br>")
let arr2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
let j = 0;
while (j < arr2.length) {
if (arr2[j] % 2 == 0) {
document.write("even number");
document. write("<br>")
} else {
document.write("odd number");
document. write("<br>")
}
j ++
}
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment