diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7a9dfa0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/2tablesquare.js b/2tablesquare.js new file mode 100644 index 0000000..a5e898a --- /dev/null +++ b/2tablesquare.js @@ -0,0 +1,29 @@ +function getTableFourByFour() { + let table = ""; + for (let i = 1; i <= 6; i++) { + for (let j = 1; j <= 6; j++) { + // lenght of number is 1 + const lengthOfNumber = getLengthOfNumber(i * j); + // 1 * 1 == 1 + const product = i * j; + //" 1" + let paddedProduct = getPaddedString(product, 3 - lengthOfNumber); + //"| 1" + table += "|" + paddedProduct; + } + table += "|" + "\n"; + } + return table; + } + function getLengthOfNumber(number) { + return number.toString().length; + } + function getPaddedString(stringToPad, numberOfPadding) { + for (let i = 0; i < numberOfPadding; i++) { + stringToPad = " " + stringToPad; + } + return stringToPad; + } + const table = getTableFourByFour(); + console.log(table); + \ No newline at end of file diff --git a/add.js b/add.js new file mode 100644 index 0000000..6a35474 --- /dev/null +++ b/add.js @@ -0,0 +1,4 @@ +let number=[1,2,3,4,5,6,7,8,9,10]; +for (i=0; i<=10; i++) { +console.log (i); +} diff --git a/arewethereyet.js b/arewethereyet.js new file mode 100644 index 0000000..c4edffb --- /dev/null +++ b/arewethereyet.js @@ -0,0 +1,9 @@ +let person=prompt("Are we there yet?"); +if (person == "no") { + alert("Are we there yet?"); +} else if (person == "spoons") { + alert("Are we there yet?"); +}else if (person == "yes") { + alert("Good"); + } + diff --git a/evenundern.js b/evenundern.js new file mode 100644 index 0000000..f82e839 --- /dev/null +++ b/evenundern.js @@ -0,0 +1,7 @@ +for(i=1; i<20; i++) +{ + if (i%2>0)continue; + console.log (i) +} + + diff --git a/square.js b/square.js new file mode 100644 index 0000000..31e38b5 --- /dev/null +++ b/square.js @@ -0,0 +1,5 @@ +let square = [1,4,9,16,25,36,49,64,81,100] +for(let i = 0; i < square.length; i++) { + console.log(Math.sqrt(square[i])) + +} diff --git a/sum.js b/sum.js new file mode 100644 index 0000000..3d973fb --- /dev/null +++ b/sum.js @@ -0,0 +1,8 @@ + function sum(start, end){ + let sum = 0; + for (start; start