{"version":"1.0","type":"rich","title":"Method/Function invocation pattern","description":"This example illustrates the distinction between method invocation and function invocation patterns in JavaScript, focusing on how the `this` binding changes context. It shows that calling a function as a property of an object (e.g., `o.incr()`) binds `this` to that object, while invoking a standalone helper function (e.g., `helper()`) binds `this` to the global object, requiring a workaround like storing `this` in a variable (`that`). The code defines an object `o` with a `value` property and demonstrates both patterns through custom functions, using plain JavaScript without any external libraries.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-1101653?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}