ConditionalOperator-2

 

Conditional Operator ? with multiple conditions.

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p id="sample"></p> <script> var firstCheck = false, secondCheck = false, access = firstCheck ? "Access denied" : secondCheck ? "Access denied" : "Access granted"; document.getElementById("sample").innerHTML = access; </script> </body> </html>
Output