Skip to content

Instantly share code, notes, and snippets.

View arayi's full-sized avatar

Melody Arayi arayi

View GitHub Profile
// 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,
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() }
};
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;