SHARE
TWEET

Untitled

a guest Aug 20th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let result = "foo";
  2. let promise = Promise.resolve("bar");
  3. promise.then(text => result = text);
  4. console.log(result);
  5.      
  6. <!DOCTYPE html>
  7. <html lang="en">
  8. <head>
  9.     <meta charset="UTF-8">
  10.     <title>Promise Test</title>
  11. </head>
  12. <body>
  13.     <script type="text/javascript">
  14.         let result = "foo";
  15.         let promise = Promise.resolve("bar");
  16.         promise.then(text => result = text);
  17.         console.log(result) // "foo"
  18.     </script>
  19. </body>
  20. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top