diff --git a/index.html b/index.html index ef9a207..645fce7 100644 --- a/index.html +++ b/index.html @@ -4,16 +4,15 @@ -
+ + + - - - @@ -33,7 +32,9 @@ - + + + The quickest of brown foxes. @@ -45,7 +46,9 @@ diff --git a/js/slide22.js b/js/slide22.js index e69de29..3a989d3 100644 --- a/js/slide22.js +++ b/js/slide22.js @@ -0,0 +1,8 @@ +let userInput = window.prompt("Please enter an integer:"); +while(true) { + if(userInput > 0 && userInput < 100) { + console.log(Math.pow(parseInt(userInput), 2)); + break; + }; + userInput = window.prompt("Please re-enter:"); +} \ No newline at end of file diff --git a/js/slide23.js b/js/slide23.js index e69de29..4f31c0f 100644 --- a/js/slide23.js +++ b/js/slide23.js @@ -0,0 +1,16 @@ +let valL = window.prompt("Please enter L:"); +let valU = window.prompt("Please enter U:"); +let output = ""; +valL = parseInt(valL); +valU = parseInt(valU); + +if(valL >= valU) { + console.log("No value within the range"); +} else { + while(valL - valU != 0) { + output += valL + " "; + valL++; + } +} +console.log(output); + diff --git a/js/slide24.js b/js/slide24.js index e69de29..cb0b077 100644 --- a/js/slide24.js +++ b/js/slide24.js @@ -0,0 +1,22 @@ +let myData = new Array(10); + +for(let i = 0; i < myData.length; i++) { + myData[i] = 1; +} +console.log(myData); + +let index; +let value; +while(true) { + index = window.prompt("Enter the index:"); + index = parseInt(index); + + // Breaks if the value is not within 1 and 10 + if(index < 0 || index >= 10) { + break; + } + + value = window.prompt("Enter the value:"); + myData[index] = parseInt(value); + console.log(myData); +} \ No newline at end of file diff --git a/js/slide25.js b/js/slide25.js index e69de29..cb0b077 100644 --- a/js/slide25.js +++ b/js/slide25.js @@ -0,0 +1,22 @@ +let myData = new Array(10); + +for(let i = 0; i < myData.length; i++) { + myData[i] = 1; +} +console.log(myData); + +let index; +let value; +while(true) { + index = window.prompt("Enter the index:"); + index = parseInt(index); + + // Breaks if the value is not within 1 and 10 + if(index < 0 || index >= 10) { + break; + } + + value = window.prompt("Enter the value:"); + myData[index] = parseInt(value); + console.log(myData); +} \ No newline at end of file diff --git a/js/slide26.js b/js/slide26.js index e69de29..558bf93 100644 --- a/js/slide26.js +++ b/js/slide26.js @@ -0,0 +1,10 @@ +let arrayFib = new Array(60); +arrayFib[0] = 0; +arrayFib[1] = 1; +console.log("First element: " + arrayFib[0]); +console.log("Second element: " + arrayFib[1]); +for(let i = 2; i < arrayFib.length; i++) { + arrayFib[i] = arrayFib[i -1] + arrayFib[i - 2]; + console.log(i + "th element: " + arrayFib[i]); +} +