how can ‘n’ or user’s input be assigned to a whole array oblznack as a condition, and why while loop doesn’t have a body, in other word what javascript have to do while that condition is true
if you already prevent the user from entering values less that 1 .then the condition (n > 0) is always true.
your if statement have no return, i understand you’re trying to loop through the array civr but you can use foreach() method for that …the first item with the index[0] should be 1000 not 100
It seems there are several issues in your JavaScript code:
In the numCheker() function, you’re trying to compare n with oblZnack, but this comparison if (n = oblZnack) is assigning oblZnack to n. You should use == or === for comparison.
Your oblZnack array is nested within another array unnecessarily. Remove the outer array brackets.
In the numCheker() function, you’re trying to loop using while(n < oblZnack), but it seems unclear what you’re trying to achieve here. This loop structure is incorrect and doesn’t make sense in the context.
const plsEnter = () => {
const inputT = input.value
if (inputT === ‘’) {
outIst.innerText = ‘Please enter a valid number’
return;
}
else if (inputT < 1) {
outIst.innerText = ‘Please enter a number greater than or equal to 1’
return;
} else if (inputT > 3999) {
outIst.innerText = ‘Please enter a number less than or equal to 3999’
return;
} else {
numCheker(inputT);
return;
}
}
if (oblZnack[n]) {
outIst.innerText = oblZnack[n];
}
}
getBtn.addEventListener(‘click’, plsEnter);
In this revised version, I’ve corrected the comparison in the numCheker() function, removed the unnecessary nesting of oblZnack, and removed the incorrect while loop.
i hope it will work for you not 100% but solve some issues