Answer the question
In order to leave comments, you need to log in
How does JS store function parameters?
Question about storing function data.
1) called the goAcceptOffer_All(888) function
after
2) called the goAcceptOffer_All(999) function
after a few seconds giving newadditems = true.
And data is displayed, but js has one thread, it turns out it should display 2 identical numbers because the same function, but it outputs 888 999, it turns out js stores data in memory for each function call?
It also raises the question of how much data it can store for each function, is there a limit?
var newadditems = false; // По умолчанию
var goAcceptOffer_All = function(data){
var additems_retry = 40;
var additemsload = function() {
additems_retry--;
// По умолчанию newadditems = false
if(newadditems == false){
// Таймер каждую 1 сек запускает функцию и проверяет не стал ли newadditems = true
setTimeout(function(){
console.log('Запустился additems');
additemsload();
}, 1000);
}else if(newadditems == true){ // Выводит данные
console.log('data: ',data);
}
}
additemsload();
}
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