What does the function then mean in JavaScript

0 votes

I've seen code that looks like this:

myObj.doSome("task").then(function(env) {
    // logic
});

Where does the function then() come from?

Nov 3 in Java by Nicholas
• 7,120 points
50 views

1 answer to this question.

0 votes
The then() method is similar to "Javascript promises," which are utilised in libraries or frameworks such as jQuery or AngularJS.

A promise is a design pattern for dealing with asynchronous actions.

The promise allows you to utilise a method named "then" to define which function(s) to use as callbacks.
answered Nov 4 by Damonlang
• 700 points

Related Questions In Java

0 votes
0 answers

What does document.forms mean in javascript?

What do the terms document.cookie, document.forms, and.value ...READ MORE

Sep 28 in Java by Nicholas
• 7,120 points
44 views
0 votes
0 answers

What is the "debounce" function in JavaScript?

The JavaScript "debouncing" feature piques my attention. Unfortunately, the code is not presented in a way that I can comprehend.  How does it function (my comments are below)? I just do not understand how this works, to put it briefly. // Returns a function, ...READ MORE

Nov 8 in Java by Nicholas
• 7,120 points
29 views
0 votes
1 answer

What does NaN mean in Java?

"NaN" stands for "not a number". "Nan" ...READ MORE

answered Jul 12, 2018 in Java by Akrati
• 960 points
889 views
0 votes
1 answer

Presenting docket dtates inside html page by javascript

Use the Docker Engine Api:Docker Engine API ...READ MORE

answered Jun 20, 2018 in Docker by DareDev
• 6,890 points
256 views
0 votes
1 answer

Migrating proxy npm repo in nexus 3

I don't think you can achieve this ...READ MORE

answered Jun 22, 2018 in DevOps Tools by DareDev
• 6,890 points
885 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

answered Jun 29, 2018 in Java by Daisy
• 8,120 points
280 views
0 votes
1 answer

Vanilla JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for it

Use Internet Explorer 9 or later if you're using VANILLA pure JavaScript without jQuery. document.addEventListener("DOMContentLoaded", function(event) { // ...READ MORE

answered Nov 8 in Java by Damonlang
• 700 points
53 views
0 votes
1 answer

What is location.search in javascript

http://example.com/index.php?foo=bar location.search > ?foo=bar ...READ MORE

answered Nov 8 in Java by Damonlang
• 700 points
41 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP