CopyPastor

Detecting plagiarism made easy.

Score: 0.9536551509936937; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2020-02-14
by Leandro Matilla

Original Post

Original - Posted on 2016-03-15
by jfriend00



            
Present in both answers; Present only in the new answer; Present only in the old answer;

If you want this type of code to run in IE11 (which does not support much of ES6 at all), then you need to get a 3rd party promise library (like [Bluebird][1]), include that library and change your coding to use ES5 coding structures (no arrow functions, no `let`, etc...) so you can live within the limits of what older browsers support.
Or, you can use a transpiler (like [Babel][2]) to convert your ES6 code to ES5 code that will work in older browsers.
Here's a version of your code written in ES5 syntax with the Bluebird promise library:
``` <script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"></script>
<script>
'use strict';
var promise = new Promise(function(resolve) { setTimeout(function() { resolve("result"); }, 1000); });
promise.then(function(result) { alert("Fulfilled: " + result); }, function(error) { alert("Rejected: " + error); });
</script> ```
[1]: http://bluebirdjs.com/docs/getting-started.html [2]: https://babeljs.io/
If you want this type of code to run in IE11 (which does not support much of ES6 at all), then you need to get a 3rd party promise library (like [Bluebird][1]), include that library and change your coding to use ES5 coding structures (no arrow functions, no `let`, etc...) so you can live within the limits of what older browsers support.
Or, you can use a transpiler (like [Babel][2]) to convert your ES6 code to ES5 code that will work in older browsers.
Here's a version of your code written in ES5 syntax with the Bluebird promise library:
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"></script>
<script>
'use strict'; var promise = new Promise(function(resolve) { setTimeout(function() { resolve("result"); }, 1000); }); promise.then(function(result) { alert("Fulfilled: " + result); }, function(error) { alert("Rejected: " + error); });
</script>

[1]: http://bluebirdjs.com/docs/getting-started.html [2]: https://babeljs.io/

        
Present in both answers; Present only in the new answer; Present only in the old answer;