create html file and write code
<!DOCTYPE html>
<html>
<head>
<title>simple alert in javascript</title>
</head>
<body>
<div>
<button onclick="press()">click here</button>
</div>
</body>
<style>
div {
display: flex;
flex-direction: row;
justify-content: center;
}
button {
border: 2px solid orange;
background-color: orange;
color: #fff;
font-family: sans-serif;
}
</style>
<script>
function press() {
let notification = alert('Congrats!');
}
</script>
</html>
Top comments (0)