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
//Write a program that creates a string that represents an 8×8 grid, using newline characters to separate lines. At each position of the grid there is either a space or a “#” character. The characters should form a chess board. | |
//When you have a program that generates this pattern, define a variable size = 8 and change the program so that it works for any size, outputting a grid of the given width and height. | |
function checkers(size) { | |
var line = ""; | |
for (var i=0; i<size; i++) { | |
for (var j=0; j<size; j++) { | |
if (j%2 === 0) line += " "; | |
else line += "#"; | |
} |
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
//http://repl.it/8R0/3 | |
//Calculate weekly and monthly cashflow after taxes and deductions. | |
var netPay = function(wage, hours) { | |
var gross = wage * hours; | |
var monthlyGross = gross * 4; | |
var annualGross = gross * 52; | |
var savings = gross * 0.1; | |
var debt = gross * 0.2; | |
var taxes = gross * 0.2; |