I need to know code is correct in JavaScript? have another way to write code && ,|| statement below code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need to know code is correct in JavaScript? have another way to write code && ,|| statement below code

let adult = 5; let children= 2; let price = adult*12 + children*5; console.log(price); if(adult<0){ adult=0; } console.log(adult); if(children<0){ children=0; } console.log(children);

23rd Jan 2023, 8:03 AM
Moahamed Azham Mohamed Ashraf
Moahamed Azham Mohamed Ashraf - avatar
1 Answer
+ 5
You can check it in js playground... Do you facing any problem with code? What is your task by this code?
23rd Jan 2023, 8:16 AM
Jayakrishna 🇮🇳