let getLowerUpperBoundFromValue=(bound , idToValue)=>{
// Returns the value of the variable previously generated if "value" is a variable name or return "value" if its a number .
// bound : can be a direct integer or a variable name.
// idToValue : contains the id to value mapping which must contain a variable whose name must be equal to 'bound' parameter if its a variable name .
if(isNaN(Number(bound)))
{
Object.entries(idToVarStatesGlobal).forEach(idStatePair=>{
let id= idStatePair[0] , varState = idStatePair[1] ;
if(varState.name===bound){
console.log("check now Returning idTovalue[id]" , idToValue , id , idToValue[id] , Number(idToValue[id]));
return Number(idToValue[id]) ;
}
})
}
else return Number(bound);
}
Когда я делаю консольный журнал следующим образом:
console.log('check now: ' , getLowerUpperBoundFromValue(varState.lowerbound , idToValue)) ;
Я получаю вывод журнала следующим образом:
check now Returning idTovalue[id] {PSfCL5hBm: 69} PSfCL5hBm 69 69
inputGeneration.js:99 check now: undefined
Почему функция, возвращающая неопределенное значение, даже еслиNumber(idTovalue[id])
равно нормальному значению 69?