The “Question mark” or “conditional” operator in JavaScript is a ternary operator that has three operands. It is the simplified operator of if/else.
Input: let result = (10 > 0) ? true : false; Output: true
Input: let message = (20 > 15) ? "Yes" : "No"; Output: Yes
condition ? value if true : value if false
<!DOCTYPE html>
<html>
<head>
<title>JavaScript</title>
<script>
var a = 100;
var b;
b = "Value is " + (a > 10 ? "True" : "False");
document.write(b);
</script>
</head>
<body>
</body>
</html>