Answer the question
In order to leave comments, you need to log in
Why doesn't the outer variable change?
const scra = require('scra');
function main(message) {
var rating;
var getRating = (data) => {
rating = data;
}
scra('тут сайт, данные которого я успешно получаю', (err, res) => {
if(err) console.error(err.message);
if(res) rating = JSON.parse(res.body);
getRating(rating);
});
console.log(rating);
}
main("fff");
rating
How can I assign the received value
to an external variable in scra
? I tried to change directly, but a new local variable is created and the callback function is used
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question