I have an array :
const values = [1, 2, 3, 4]
And I'm trying to perform some HOC functions on it ( forEach,every..) for example :
values.forEach(() => {
const bool = typeof value == "number";
console.log(bool)
})
The code above works correct ( Without error ) even the result is false and the value should be undefined because I thought that I passed value ( Typo error ) like this :
values.forEach(value => {
const bool = typeof value == "number";
console.log(bool)
})
My question why Javascript does not warn me or throw an error from this method?
typeof someUndefinedVariablewill never result in an error.