Thanks for your post! Some of the aforementioned threats are handled if you are using TypeScript.
Also, there's something I've noticed:
From your calculatingStuffv2 function:
if(!num){returnnewError('Not a number!')}
You can't use num = 0 here. However, 0 is a valid number. Besides, you could still use Infinity. Which is a valid number in my opinion. Better to check for a defined minimum and maximum then.
Full stack Engineer, working hard to deliver the best quality code. Passionate about finding innovative ways to make positive social impact through technology, education and best security practices.
Thanks for your post! Some of the aforementioned threats are handled if you are using TypeScript.
Also, there's something I've noticed:
From your
calculatingStuffv2
function:You can't use
num
=0
here. However, 0 is a valid number. Besides, you could still useInfinity
. Which is a valid number in my opinion. Better to check for a defined minimum and maximum then.Thanks for the observation, that's a great point. I'll do some more experiments :)