Answer the question
In order to leave comments, you need to log in
What is this syntax?
Good afternoon!
There is a function: https://jsfiddle.net/3drhqapa/
Returns a promise.
I did it as in the tutorial: https://learn.javascript.ru/promise#promise-resolv...
The thing is, here is this piece of code:
video_get('-648623423','').then(
response => {console.log("Success" + response)},
error => {console.log("ERROR:" + error)}
);
Answer the question
In order to leave comments, you need to log in
This is most likely babel, after compilation the output will be:
video_get('-64866375', '').then(function (response) {
console.log("Success" + response);
}, function (error) {
console.log("ERROR:" + error);
});
This is the syntax of ECMAScript 2015. I think you have everything written correctly: then() takes two arguments, the first of which is a function that will be executed if the promise is fulfilled, and the second is a function that will be executed if an error occurs. The functions are given as arrows. This construct even works: it tells me that an error has occurred, because $http does not exist.
Maybe PHPStorm thinks it's bad when the anonymous function is not immediately executed and passed to some variable. Look here , it seems to me there is the same kind of error.
In general, this is not even an error, but a warning, isn't it? You can actually score on it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question