InterviewSolution
Saved Bookmarks
| 1. |
Is there any function in jquery to filter an array or array-like object? |
|
Answer» Deffered() method is used if you write your own FUNCTION and want to provide a promise to the calling code. A deferred object can create a promise and can change its STATE to RESOLVED or rejected. The following is the example of how simple Deffered object works. // Existing object var OBJ = { hello: function( name ) { ALERT( "Hello " + name ); } }, // Create a Deferred defer = $.Deferred(); // Set object as a promise defer.promise( obj ); // Resolve the deferred defer.resolve( "John" ); // Use the object as a Promise obj.done(function( name ) { obj.hello( name ); // Will alert "Hello John" }).hello( "Karl" ); // Will alert "Hello Karl" |
|