Skip to content
This repository was archived by the owner on Dec 2, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mario.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<script src="mario.js"></script>
<title>Beautiful pyramid</title>
</head>
<body>
<h1>Mario 1</h1>
<form onsubmit="return false">
<input id="height" type="number" placeholder="Height of pyramid" required />
<button>Click for build the pyramid!</button>
</form>
<p>
Want to see a beautiful pyramid?
Open up the developer tools and look at the Console.
</p>
<script src="mario.js"></script>
</body>
</html>
10 changes: 8 additions & 2 deletions mario.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@

printPyramid(5);

/* Add Event Listener to the button */
const button = document.querySelector("button");
const input = document.querySelector("input");
button.addEventListener("click", function () {
if(input.value)
printPyramid(input.value);
}, false);

/*
* printPyramid
Expand All @@ -14,6 +19,7 @@ printPyramid(5);
* ######
*/
function printPyramid(height) {
console.log(height);
console.log("Uh oh... the pyramid is under construction.");
console.log("Check back soon, our developers are hard at work as we speak!");

Expand Down