+ 1

Please Correct this Code

It is Always showing Else Statement, not showing IF statement, please tell me what wrong i have done in this code https://code.sololearn.com/c6vlVKWcVQSp/?ref=app

20th Feb 2022, 8:31 AM
Ankur Jha
Ankur Jha - avatar
3 odpowiedzi
+ 3
Ankur Jha Check function parameter there is 'a' not 'age'
20th Feb 2022, 8:35 AM
A͢J
A͢J - avatar
+ 2
Ankur Jha Function can be defined in many ways 1 - with parameters 2 - without parameters If you want to pass arguments to the function from outside then you have to define function with parameters. So function checkAge(age) { if (age > 18) // above 18 else // Below 18 } Here we are passing value from outside so this function would be call like this: checkAge(50) -----and this is without parameters---- function age() { var age = 50; if(age >= 18) console.log("You can Drink"); else console.log("You cannot Drink"); }
20th Feb 2022, 8:50 AM
A͢J
A͢J - avatar
0
A͢J Thanks a Lot Bro, I'm Confused for this from 2 days😌
20th Feb 2022, 8:44 AM
Ankur Jha
Ankur Jha - avatar