Answer the question
In order to leave comments, you need to log in
How to complete the game in js?
Here is the Clicker game code!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script href=""></script>
<title>document</title>
</head>
<body>
<h2></h2>
<div id="result"></div>
<div class="home" onclick="gag()" style="background: red; width: 200px; height: 200px;"></div>
<script>
document.getElementById("result").innerHTML = localStorage.clickcount;
function gag() {
if(typeof(Storage) !== "undefined") {
if (localStorage.clickcount) {
localStorage.clickcount = Number(localStorage.clickcount)+1;
} else {
localStorage.clickcount = 1;
}
document.getElementById("result").innerHTML = localStorage.clickcount;
}
}
</script>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question