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
// This is an example of JS prototypes in a simple, | |
// incomplete game about keeping pet triangles. | |
// Triangles are rats. | |
// They go beep and trundle (among other things). | |
// Just roll with it. | |
// Here's our prototype for a standard triangle! | |
// As you can see, they each have a name, | |
// make beeping sounds when poked, trundle around, |
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
var fizzBuzz = function(max) { | |
if (max == 2) { return "Shiny JS Recursive FizzBuzz! :D\n" } | |
else if (max % 15 === 0) { return fizzBuzz(max - 1) + "\nFizzBuzz" } | |
else if (max % 5 === 0) { return fizzBuzz(max - 1) + "\nBuzz" } | |
else if (max % 3 === 0) { return fizzBuzz(max - 1) + "\nFizz" } | |
else { return fizzBuzz(max-1) + "\n" + max.toString() } | |
}; |
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
var playerScore = 0; | |
var correctGuesses = []; | |
// A function to get the set of possible letters | |
function getLetters() { | |
// Select the element with the id 'letters' | |
var lettersContainer = document.querySelector('#letters'); | |
// Get the text content of the element | |
var letters = lettersContainer.innerText; |