Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Ternary Operator</title> </head> <body> <script> var age = 21; var userType = age < 18 ? 'Child' : 'Adult'; document.write(userType); // Prints Adult </script> </body> </html>