File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 1- // truthy-falsy.js
2-
3- // INFO: What are Truthy and Falsy Values?
4-
5- /*
1+ /* INFO: What are Truthy and Falsy Values?
62In JavaScript, every value is either "truthy" or "falsy" when evaluated in a Boolean context (like inside an if condition).
73
8- - **Falsy values** are those that are considered false when converted to a Boolean.
9- - **Truthy values** are all other values that are considered true.
10-
11- Knowing which values are falsy helps avoid bugs and write cleaner conditions.
12-
13- ---
4+ - Falsy values** are those that are considered false when converted to a Boolean.
5+ - Truthy values** are all other values that are considered true.
6+ */
147
8+ /*
159JavaScript's falsy values are exactly these:
1610
17111. false
@@ -25,7 +19,7 @@ JavaScript's falsy values are exactly these:
2519Everything else is truthy.
2620*/
2721
28- // NOTE: Falsy Values in JavaScript
22+ // Falsy Values in JavaScript
2923if ( ! false ) console . log ( "false is falsy" ) ;
3024if ( ! 0 ) console . log ( "0 is falsy" ) ;
3125if ( ! - 0 ) console . log ( "-0 is falsy" ) ;
You can’t perform that action at this time.
0 commit comments