Skip to content

Instantly share code, notes, and snippets.

@AliceWonderland
Forked from anonymous/7.1 Counter.js
Created April 18, 2017 07:25
Show Gist options
  • Save AliceWonderland/eba31f47c39faee4fb065ef433b165cb to your computer and use it in GitHub Desktop.
Save AliceWonderland/eba31f47c39faee4fb065ef433b165cb to your computer and use it in GitHub Desktop.
7.1 Counter created by smillaraaq - https://repl.it/HHjJ/1
var counter = 0;
function increment(num){
counter += num;
console.log("counter: " + counter);
}
increment(2); // counter is now 2
increment(6); // counter is now 8
increment(-1); // counter is now 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment