loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.2670532219398605","path":"main.js","file":{"path":"main.js","content":{"asEncoding":{"base64":"ZnVuY3Rpb24gcHJvbWlzZU51bWJlckNoZWNrKGFyZ3VtZW50KSB7IAogICAgIGlmKGlzTmFOKGFyZ3VtZW50KSkgewogICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGFyZ3VtZW50ICsgIiBpcyBub3QgYSBudW1iZXIiKTsgCiAgICAgfSBlbHNlIHsgCiAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCJXZSBnb3QgbnVtYmVyICIgKyBhcmd1bWVudCk7CiAgICAgfQp9CmxldCB0ZXN0MSA9IHByb21pc2VOdW1iZXJDaGVjaygxKTsKbGV0IHRlc3QyID0gcHJvbWlzZU51bWJlckNoZWNrKCJub3RoaW5nIik7Cgp0ZXN0MS50aGVuKGZ1bmN0aW9uKHJlc3VsdCkgewoJY29uc29sZS5sb2cocmVzdWx0KTsKfSwgZnVuY3Rpb24oZXJyb3IpIHsgCiAgY29uc29sZS5sb2coZXJyb3IpOwp9KTsKCnRlc3QyLnRoZW4oZnVuY3Rpb24ocmVzdWx0KSB7Cgljb25zb2xlLmxvZyhyZXN1bHQpOwp9KS5jYXRjaChmdW5jdGlvbihlcnJvcikgeyAKICAgY29uc29sZS5sb2coZXJyb3IpOwp9KTs="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function promiseNumberCheck(argument) { 
     if(isNaN(argument)) {
       return Promise.reject(argument + " is not a number"); 
     } else { 
       return Promise.resolve("We got number " + argument);
     }
}
let test1 = promiseNumberCheck(1);
let test2 = promiseNumberCheck("nothing");

test1.then(function(result) {
	console.log(result);
}, function(error) { 
  console.log(error);
});

test2.then(function(result) {
	console.log(result);
}).catch(function(error) { 
   console.log(error);
});
Native Browser JavaScript