@AriTelford1/

TrickyPreviousBinarytree

HTML, CSS, JS

No description

fork
loading
Files
  • index.html
  • script.js
  • style.css
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html>
  <head>
    <script src="jquery-3.4.0.min.js"></script>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>repl.it</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <script src="script.js"></script>
    <script>
      var names = ['Joe', 'Kylie', 'Bob', 'Taylor', 'John', 'Christiana', 'Hellen', 'Jefferson', 'Thea', 'Toby', 'Catherine', 'Vivian', 'Lynda', 'Stephen', 'Ashley', ''];
      var lastNames = ['Sherman', 'Williamson', 'Denton', 'Leon', 'Cunningham', 'Parkinson', 'Coles', 'Drew'];
      var name = names[Math.floor(Math.random()*names.length)];
      var lastName = lastNames[Math.floor(Math.random()*lastNames.length)];
      document.body.onkeyup = function(e){
          if(e.keyCode == 32){
              alert("Your randomly generated name is " + name + " " + lastName + ".");
                    name = names[Math.floor(Math.random()*names.length)];
                    lastName = lastNames[Math.floor(Math.random()*lastNames.length)];
          }
      };
      </script>
  </body>
</html>
result
console