JavaScript Practice 3

In this example below you will see how to do a JavaScript Practice 3 with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by 210296, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 210296 ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>JavaScript Practice 3</title>
  
  
  
  
  
</head>

<body>

  <button onclick="brandon()">
  Click Here!
</button>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/210296/javascript-practice-3-qZVMaX */
function brandon() {
  var score = 0;
  var q1 = prompt("What color is the telephone?")
  if(q1 === "black"){
    var score = score + 10;
    alert("Congrats! You have" + score + "points!")
  }
  else if(q1 === "dark gray"){
    var score = score + 2;
    alert("Nice try, you get" + score + "points")
  }
  else{
    var score = score - 10;
    alert("WRONG!!! You have" + score +   "points");
    alert("Try again");
  }
}

Comments