3 ms·
Consider JavaScript's "call" if you are familiar with that: You say somefunk.call (someObject, ...someArgs) The function executes in the context of 'someObje
by galaxyLogic 8y ago
Consider JavaScript's "call" if you are familiar with that:
You say somefunk.call (someObject, ...someArgs)
The function executes in the context of 'someObject' meaning it can read and write its fields with expressions like 'this.color = "blue"'.
You could say that somefunk() is a method and you are making a method-call. But it is not a method of 'someObject'. Yet by calling it you CAN manipulate the fields of someObject.
JavaScript is NOT the type of "Message passing/Object-Oriented" system like Smalltalk-80. You can communicate with objects, meaning share information with them, meaning read and write their fields, by means other than their methods only.