+ 2
Can I use Conditional Statement like If and Else in Function like -
function age(a){ if(age>=18){ console.log("You can Drink") } else{ console.log("You cannot Drink") } return b; }
2 Answers
+ 5
You can also use ternary operator
Its easy & short too
console.log(age>=18?"you can drink " : "you cannot drink" )
but what is "b" ? on the last line
``
return b;
``
+ 1
Pariket Thakur Actually, I'm a Beginner of Javascript, typing b is my mistake, I Don't know what is thatđ