Object Oriented JavaScript Tutorial

Syntax

object.watch(prop, function)
The watch() method watches for the event in which a property gets assigned a value.
When the assignment is made, a user defined function is executed.
The method itself takes the property to watch, prop, and the function to call, func, when the event occurs.


    
    Example of the watch method