Skip to content

Instantly share code, notes, and snippets.

@ticidesign
Created February 25, 2017 09:20
Show Gist options
  • Save ticidesign/c74f7bac43a3c6e1eea8863b67555c5e to your computer and use it in GitHub Desktop.
Save ticidesign/c74f7bac43a3c6e1eea8863b67555c5e to your computer and use it in GitHub Desktop.
A function that takes a size and returns a string of alternating '1s' and '0s'.
function stringy(size) {
// your code here
var word = "";
for(var i = 0; i < size; i++) {
word += i%2 === 1? "0" : "1";
}
return word;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment