Skip to content

Instantly share code, notes, and snippets.

@Queeniebee
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save Queeniebee/e635a391de0c61d6fca8 to your computer and use it in GitHub Desktop.

Select an option

Save Queeniebee/e635a391de0c61d6fca8 to your computer and use it in GitHub Desktop.
var http = require("http");
console.log("Now running CracklePop!");
console.log("You can also navigate to \'localhost:5335\' to see the game");
console.log("But it is better to view it here.");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/html; charset=utf8"});
cracklePop(request, response);
}).listen(5335);
function cracklePop(request, response){
response.write("!CracklePop!");
var crackle = "Crackle";
var pop = "Pop";
var cracklePop = "CracklePop";
for(var x = 1; x < 101; x++){
if((x % 3 == 0) && (x % 5 == 0)){
response.write(cracklePop + '\t');
console.log(cracklePop);
} else if((x%3 == 0)){
response.write(crackle + '\t');
console.log(crackle);
} else if ((x % 5 == 0)){
response.write(pop + '\t');
console.log(pop);
} else {
response.write(x + '\t');
console.log(x);
}
}
response.end("You've just run CracklePop!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment