Có, có thể chuyển đổi Boolean thành Integer trong JavaScript bằng Toán tử bậc ba.
Ví dụ
Bạn có thể thử chạy đoạn mã sau để chuyển đổi Boolean thành Số nguyên -
<html>
<head>
<title>JavaScript Boolean</title>
</head>
<body>
<script>
var answer = true;
document.write(answer);
var pass_marks = answer ? 90 : 40;
document.write("<br>Passing Marks: "+pass_marks);
</script>
</body>
</html>