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, 2022 in Java by Nicholas
• 7,760 points
579 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, 2022 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, 2022 in Java by Nicholas
• 7,760 points
353 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, 2022 in Java by Nicholas
• 7,760 points
222 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
1,694 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
494 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
1,215 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
573 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, 2022 in Java by Damonlang
• 700 points
2,243 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, 2022 in Java by Damonlang
• 700 points
271 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