This file contains hidden or 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
var hashtag = "#"; | |
while (hashtag.length <= 7) { | |
console.log(hashtag); | |
hashtag += "#"; | |
} |
This file contains hidden or 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
for (var i = 1; i <= 100; i++) | |
if(i % 3 == 0) | |
console.log("Fizz"); | |
else | |
console.log(i); | |
<!-- //// Result 1 | |
2 | |
Fizz | |
4 |
This file contains hidden or 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
for (var i = 1; i <= 100; i++) | |
if(i % 3 == 0) | |
console.log("Fizz"); | |
else if(i % 5 == 0) | |
console.log("Buzz"); | |
else | |
console.log(i); | |
<!-- 1 | |
2 |
This file contains hidden or 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
for (var i = 1; i <= 100; i++) | |
if ((i % 3 == 0) && (i % 5 == 0)) | |
console.log("FizzBuzz"); | |
else if (i % 3 == 0) | |
console.log("Fizz"); | |
else if (i % 5 == 0) | |
console.log("Buzz"); | |
else | |
console.log(i); | |
This file contains hidden or 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
for (var i = 0; i < 4; i++) { | |
console.log(" "+"#"+" "+"#"+" "+"#"+" "+"#"+"\n"); | |
for (var j = 0; j < 1; j++) { | |
console.log("#"+" "+"#"+" "+"#"+" "+"#"+" "+"\n"); | |
} | |
} | |
// Answer: | |
// # # # # | |
// # # # # | |
// # # # # |
This file contains hidden or 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
//Don't understand functions very well. Decided to write | |
//it in a way that I would understand as a former finance associate. | |
function insurancecost(fee) { | |
return function(staffsize) { | |
return staffsize * fee; | |
}; | |
} | |
var portlandoffice = insurancecost(30000); | |
console.log(portlandoffice(97)) |
This file contains hidden or 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
function min(x,y) { | |
if (x > y) | |
return y; | |
else (x < y) | |
return x; | |
}; | |
console.log(min(0, 10)); | |
// → 0 | |
console.log(min(0, -10)); | |
// → -10 |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<p>My Cat is...</p> | |
<p id="demo"></p> | |
<script> | |
var myCat = {texture:"fluffy", breed:"Calico", color:"white", age: 4}; |
This file contains hidden or 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
function reverse(string) { | |
for (var i = string.length - 1, o = ''; i >= 0; o += string[i--]) { } | |
return o; | |
} | |
console.log(reverse("I love Coding House!")); |
This file contains hidden or 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
/* Write a javascript counter function that takes a text argument and count the following: | |
Number of words in the text | |
Number of characters in the text | |
Number of spaces in the text | |
Average word length | |
Test case |
OlderNewer