Để hiển thị giá trị biến JavaScript trong hộp cảnh báo, hãy thử chạy mã sau -
Ví dụ
<html>
<head>
<script>
function display() {
var a = "Simple";
var b = "Learning";
alert(a +" Easy "+ b);
}
</script>
</head>
<body>
<input type="button" value="Click me!" onClick="display();">
</body>
</html>