Hi guys,
I am fairly new to Javascript and I am trying to return a value from a function and use that returned value in a different function. I am however having some problem with it.
To simplify the question I am trying to return at the line “return [1,1]” but I always get a return at “return [1]”. Any help will be appreciated. Thanks.
function test(){
getTopStories(true).then(function (topIds){
for(var i = 0; i < 10; i++){
callFetch(topIds[i],i);
}
return [1,1];
})
.catch(error => {
console.log('There was an error: ', error);
});
return [1];
}