Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Exercise = (function(){
- var steps = 0;
- function increaseSteps(){
- steps++;
- }
- return{
- getTotalSteps:function(){
- return steps;
- },
- walk:function(){
- increaseSteps();
- }
- };
- }());
- Exercise.walk(); //will increase the the step + 1
- Exercise.getTotalSteps() //will return the total number of steps walked
Add Comment
Please, Sign In to add comment