Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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}"
}
]
}
29 changes: 29 additions & 0 deletions 2tablesquare.js
Original file line number Diff line number Diff line change
@@ -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);

4 changes: 4 additions & 0 deletions add.js
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions arewethereyet.js
Original file line number Diff line number Diff line change
@@ -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");
}

7 changes: 7 additions & 0 deletions evenundern.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
for(i=1; i<20; i++)
{
if (i%2>0)continue;
console.log (i)
}


5 changes: 5 additions & 0 deletions square.js
Original file line number Diff line number Diff line change
@@ -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]))

}
8 changes: 8 additions & 0 deletions sum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function sum(start, end){
let sum = 0;
for (start; start<end;start++) {
sum = sum + start;
}
return sum;
}
console.log (sum(5,10))
28 changes: 28 additions & 0 deletions tablesquare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function getTableFourByFour() {
let table = "";
for (let i = 1; i <= 4; i++) {
for (let j = 1; j <= 4; 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);
1 change: 1 addition & 0 deletions triangle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
do
8 changes: 8 additions & 0 deletions triangleloop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let text= '';
for (let i=1; i<=5 ; i++) {
for(let j = 1; j <= i; j++){
text += '*';
}
text += '\n';
}
console.log(text);