javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Tower</title>
</head>
<body
style="
background: black;
color: white;
text-align: center;
font-size: 72px;
line-height: 0px;
letter-spacing: -8px;
"
>
<script>
function tower() {
numberOfFloors = 10;
currentFloor = "*";
for (let i = 1; i <= numberOfFloors; i++) {
const floor = document.createElement("p");
floor.innerText = currentFloor;
document.body.appendChild(floor);
currentFloor += "**";
}
}
tower();
</script>
</body>
</html>
This is a public paste that anyone can view.
Share