From 5b27f72ab67c3c036ab90e5d7072745bef83f3ea Mon Sep 17 00:00:00 2001 From: Issam Ahwach Date: Thu, 9 Nov 2023 14:59:50 +0200 Subject: [PATCH] Update password-generator.js Improve readability and maintainability by using the fact that true evaluates to 1 in JavaScript and false evaluates to 0 --- src/password-generator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/password-generator.js b/src/password-generator.js index d571ee3..6b4d0ca 100644 --- a/src/password-generator.js +++ b/src/password-generator.js @@ -29,7 +29,7 @@ class PasswordGenerator{ generatePassword(){ let password = ""; - const typesCount = Object.values(this.settings).filter(item=>{if(item===true) return item}).length; + const typesCount = Object.values(this.settings).filter((item) => item).length; const typesArr = Object.keys(this.settings) .filter((item) => { if(this.settings[item]===true)