error: endsWith() is not a function.this is my code:
function download(val){
return new Promise(function(resolve,reject){
if(val.startsWith(“http”))
{
console.log(“downloaded”)
resolve(val);
}
else{
reject(“not”);
}
})
}
function resize(val){
return new Promise(function(resolve,reject){
if(val.endsWith(".png"))
{
resolve(“resize”);
}
else{
reject(“not2”);
}
})
}
Promise.all([download(“http:njxnkn.png”),download(“http-cx.png”)]).then(resize).then(function(val){
return Promise.all(val.map(resize))
}).then(function(values){
console.log(values);
}).catch(function(val){
console.log(val);
})