Skip to content

Commit

Permalink
Review of function and scope.
Browse files Browse the repository at this point in the history
  • Loading branch information
atom-box committed Oct 30, 2021
1 parent 2eb8f11 commit 3f01ac6
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions hoister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// hoister.js


let a = 5;
const b = 55;
var c = 555;
d(c);

function d(argyBargy) {
console.log(argyBargy);
}

var jellyBeans = (function(){
var count = 33;
return {
increment: function(){
count++;
},
get: () => {
return count;
}
}
})();

console.log(jellyBeans.get());
jellyBeans.increment();
jellyBeans.increment();
jellyBeans.increment();
jellyBeans.increment();
jellyBeans.increment();
jellyBeans.increment();
console.log("The number of beans is " + jellyBeans.count);
console.log(jellyBeans.get());

0 comments on commit 3f01ac6

Please sign in to comment.