Window.alert()
- The window.alert() method is used to display output to the user.
- It indicates that the added message in an alert box has the “OK” button.
- The alert box forces the user to read the displayed message, and the user cannot access the web page until the alert box is closed.
Syntax:
Window.alert("parameter")
In the “Parameter”, pass the message you want to display in the added alert box.
Example:
<!DOCTYPE html>
<html>
<body>
<h1>Quipoin</h1>
<script>
window.alert("This is Quipoin.com");
</script>
</body>
</html>
Output:
Console.log()
- console.log() method is used for outputting information to the browser's console.
- It used for debugging purpose
Example:
<!DOCTYPE html>
<html>
<body>
<h2>Activate Debugging</h2>
<p>F12 on your keyboard will activate debugging.</p>
<p>Then select "Console" in the debugger menu.</p>
<p>Then click Run again.</p>
<script>
console.log(5 + 6);
</script>
</body>
</html>
Output: