Guest User

Untitled

a guest
Dec 15th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. var Exercise = (function(){
  2. var steps = 0;
  3. function increaseSteps(){
  4. steps++;
  5. }
  6. return{
  7. getTotalSteps:function(){
  8. return steps;
  9. },
  10. walk:function(){
  11. increaseSteps();
  12. }
  13. };
  14. }());
  15.  
  16. Exercise.walk(); //will increase the the step + 1
  17. Exercise.getTotalSteps() //will return the total number of steps walked
Add Comment
Please, Sign In to add comment