startit/eloquentjavascript/loopingatriangle.html

19 lines
488 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button onclick="start()">start</button>
<div id="triangle"><ul>#</ul></div>
<script>
let triangle = "#";
function start(){
triangle += "#"
document.getElementById('triangle').innerHTML += `<ul>${triangle}</ul>`
}
</script>
</body>
</html>