From 02a28858ed994e8d815b0bc6b60a6d352d8562a1 Mon Sep 17 00:00:00 2001 From: Aayan Patel <121517985+aayanofficial5@users.noreply.github.com> Date: Mon, 31 Mar 2025 14:38:49 +0530 Subject: [PATCH 1/2] truthy values issue explained --- .../03_booleans_operators_date.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/03_Day_Booleans_operators_date/03_booleans_operators_date.md b/03_Day_Booleans_operators_date/03_booleans_operators_date.md index bb376ae46..c01d00354 100644 --- a/03_Day_Booleans_operators_date/03_booleans_operators_date.md +++ b/03_Day_Booleans_operators_date/03_booleans_operators_date.md @@ -76,6 +76,17 @@ We agreed that boolean values are either true or false. - All strings are truthy except an empty string ('') - The boolean true +#### ⚠️ Note: +Even though non-zero numbers and decimal numbers(like -1,1.5,etc) are truthy in a Boolean context, they are not equal to true when using ==. + +Example: Truthy but not equal to true + +if (-1) → Evaluates to true because -1 is truthy. + +-1 == true → Returns false because true is coerced to 1, and -1 is not equal to 1. + +To explicitly check the truthiness of a value, use Boolean(value) or use them in if-else , while or do-while conditional statements. + ### Falsy values - 0 From 1be1332e5ca66f140a556a4428e2d39cb26cbfdd Mon Sep 17 00:00:00 2001 From: aayanofficial5 Date: Mon, 31 Mar 2025 14:58:51 +0530 Subject: [PATCH 2/2] file name corrected --- ...{13_day_console_object_methods.md => 14_Day_Error_handling.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename 14_Day_Error_handling/{13_day_console_object_methods.md => 14_Day_Error_handling.md} (100%) diff --git a/14_Day_Error_handling/13_day_console_object_methods.md b/14_Day_Error_handling/14_Day_Error_handling.md similarity index 100% rename from 14_Day_Error_handling/13_day_console_object_methods.md rename to 14_Day_Error_handling/14_Day_Error_handling.md