Created
May 29, 2021 05:53
This file contains hidden or 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
// creates a new variable 'counter' and set it's initial value to 0; | |
let counter = 0; | |
// creates a new function 'addOne' which takes 0 parameters | |
function addOne() { | |
// adds one to counter. Equivalent to counter = counter + 1; | |
counter++; | |
} | |
// calling a function. This executes the body of the named function. | |
addOne(); | |
// prints our result to the console | |
console.log(counter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment