Skip to content

Instantly share code, notes, and snippets.

@rohan-paul
Last active October 21, 2016 11:54
Show Gist options
  • Save rohan-paul/8c6087c65845b8b3ba25fd5ea8a8e70d to your computer and use it in GitHub Desktop.
Save rohan-paul/8c6087c65845b8b3ba25fd5ea8a8e70d to your computer and use it in GitHub Desktop.
var Website = {
updatePageView: function() {
for(var i = 0; i < arguments.length; i++) {
this.pageViewNumber += arguments[i];
}
return this.pageViewNumber;
}
}
var profilePage = {
name: 'My Web page',
pageViewNumber: 0
};
Website.updatePageView.call(profilePage, 5, 6, 7, 8);
console.log(Website.updatePageView.call(profilePage));
// Output => 26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment