Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To my knowledge, there isn't a built-in <code>then()</code> method in <code>javascript</code> (at the time of this writing).</p> <p>It appears that whatever it is that <code>doSome("task")</code> is returning has a method called <code>then</code>.</p> <p>If you log the return result of <code>doSome()</code> to the console, you should be able to see the properties of what was returned.</p> <pre><code>console.log( myObj.doSome("task") ); // Expand the returned object in the // console to see its properties. </code></pre> <p><strong>UPDATE (As of ECMAScript6)</strong> :-</p> <p>The <code>.then()</code> function has been included to pure javascript. </p> <p>From the Mozilla documentation <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then" rel="noreferrer">here</a>,</p> <blockquote> <p>The then() method returns a Promise. It takes two arguments: callback functions for the success and failure cases of the Promise.</p> </blockquote> <p>The Promise object, in turn, is defined as</p> <blockquote> <p>The Promise object is used for deferred and asynchronous computations. A Promise represents an operation that hasn't completed yet, but is expected in the future.</p> </blockquote> <p>That is, the <code>Promise</code> acts as a placeholder for a value that is not yet computed, but shall be resolved in the future. And the <code>.then()</code> function is used to associate the functions to be invoked on the Promise when it is resolved - either as a success or a failure.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload