+ 7

Hi, Is it possible solve the problem without using "if else" conditional and how ?

Javascript sololearn pro https://code.sololearn.com/W5s5V17o6Lu6/?ref=app

19th Jan 2021, 5:11 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
14 Réponses
+ 6
I tried but notting is appeared https://code.sololearn.com/WRAVOlZXt5av/?ref=app
19th Jan 2021, 5:43 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 6
Thanks TheWh¡teCat 🇧🇬 ☺️
19th Jan 2021, 7:37 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
21st Jan 2021, 6:23 AM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 6
You could use if(case1, case2, case3) or yiu could use logical operaters like if(case1 && case2 && case3)
21st Jan 2021, 11:38 AM
Kikomeko Markarious
Kikomeko Markarious - avatar
+ 5
TheWh¡teCat 🇧🇬 ,Yes that's right. Thanks to You very much ☺️
19th Jan 2021, 7:15 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 3
You can use simple if or if else if ladder or nested if ,if you want to use other than if else
20th Jan 2021, 4:56 PM
Ayush Pandey
Ayush Pandey - avatar
+ 3
EGO OK, you removed the Node.js code I see.
21st Jan 2021, 7:10 PM
Sonic
Sonic - avatar
+ 2
I can't open your link
20th Jan 2021, 7:58 PM
Sonic
Sonic - avatar
+ 1
EGO , for example you can use ternary operator to do it. Look at the code. https://code.sololearn.com/W9f01xnYZtcs/?ref=app
19th Jan 2021, 5:20 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
EGO , because it is written for node.js.
19th Jan 2021, 7:12 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
EGO , in the following link you can find how to use readline function with node: https://nodejs.org/api/readline.html
19th Jan 2021, 7:35 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
You are welcome, EGO 🐱
19th Jan 2021, 7:41 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Hello EGO use switch statement or ternary operator to eliminate if-else.
20th Jan 2021, 4:41 AM
Mohd Aadil
Mohd Aadil - avatar
+ 1
In some cases, we can use recursion instead of if-else
21st Jan 2021, 4:21 PM
Ali Raza
Ali Raza - avatar