From 2385b2e4b2b5c4f83469bafab04dba54dc6c0154 Mon Sep 17 00:00:00 2001 From: Chety Date: Thu, 23 Jul 2020 17:00:18 +0300 Subject: [PATCH] Update 14_day_error_handling.md Change Number.isNaN to Number.isFinite to check if the given input is a number or not --- 14_Day_Error_handling/14_day_error_handling.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14_Day_Error_handling/14_day_error_handling.md b/14_Day_Error_handling/14_day_error_handling.md index 696db4a..5a7cb8a 100644 --- a/14_Day_Error_handling/14_day_error_handling.md +++ b/14_Day_Error_handling/14_day_error_handling.md @@ -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'