In the codebase I'm working on, I encountered code like this:
try {
price = parseFloat(price);
} catch (err) {
console.log(err);
}
I know that in most cases where price
cannot be turned into a number, it'll simply get the value of NaN
instead. My question is: are there cases where it will throw an error, making the try-catch-construction necessary?