-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7980049
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<h1>CSV Parser in JavaScript</h1> | ||
<script> | ||
var s = "ID,Name,Occupation,Age\n42,Bruce,Knight,41\n57,Bob,Fry Cook,19\n63,Blaine,QuizMaster,58\n98,Bill,Doctor's Assistant,26"; | ||
var cells = []; | ||
cell = ""; | ||
for (i = 0; i < s.length; i++) { | ||
if (s[i] == "," || s[i] == "\n") { | ||
|
||
cells.push(cell); | ||
cell = ""; | ||
|
||
continue; | ||
} | ||
cell += s[i]; | ||
// console.log(cells); | ||
// console.log(cell); | ||
|
||
} | ||
cells.push(cell); | ||
// console.log(cells); | ||
for (i = 0; i < cells.length / 4; i++) { | ||
console.log( | ||
cells[4 * i], | ||
cells[4 * i + 1], | ||
cells[4 * i + 2], | ||
cells[4 * i + 3] | ||
); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Fizz Buzz</title> | ||
<!-- <script src="./FizzBuzz.js" defer></script> --> | ||
</head> | ||
<body> | ||
<h1>Fizz Buzz in JavaScript</h1> | ||
<script> | ||
// Loop through all numbers from 1 to 100. | ||
// If a number is divisible by 3, log “Fizz.” | ||
// If a number is divisible by 5, log “Buzz.” | ||
// If a number is divisible by both 3 and 5, log “Fizz Buzz.” | ||
// If a number is not divisible by either 3 or 5, log the number. | ||
for(let i = 1; i <= 100; i++) { | ||
if(i % 3 == 0 && i % 5 == 0){ | ||
console.log("Fizz Buzz."); | ||
}else if(i % 5 == 0){ | ||
console.log("Buzz."); | ||
}else if(i % 3 == 0) { | ||
console.log("Fizz."); | ||
}else { | ||
console.log(i); | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<h1>Prime Time</h1> | ||
<script> | ||
var n = 8; | ||
for (i = n + 1; ; i++) { | ||
isPrime = true; | ||
for (j = 2; j < i; j++) { | ||
if (i % j == 0) { | ||
isPrime = false; | ||
} | ||
} | ||
if (isPrime == true) { | ||
console.log(i); | ||
break; | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |