Update 14_day_error_handling.md

Change Number.isNaN to Number.isFinite to check if the given input is a number or not
pull/95/head
Chety 5 years ago committed by GitHub
parent 8d0e1b0ecd
commit 2385b2e4b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -118,7 +118,7 @@ const throwErroExampleFun = () => {
let x = prompt('Enter a number: ')
try {
if (x == '') throw 'empty'
if (isNaN(x)) throw 'not a number'
if (!Number.isFinite(x)) throw 'not a number'
x = Number(x)
if (x < 5) throw 'too low'
if (x > 10) throw 'too high'

Loading…
Cancel
Save