repl.it
@mcuringa/

week2-exercises

HTML, CSS, JS

an introduction to variables, functions, and for loops using turtle.

fork
loading
Files
  • index.html
  • index.js
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
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>repl.it</title>
    <link href="index.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <script>
      function rand (a, b) {
        return Math.floor(Math.random() * Math.floor(b - a)) + a;
      }

      function choose (t) {
        const i = rand(0,t.length); 
        return t[i];
      }
    </script>
    <script crossorigin="anonymous" src="https://casual-effects.com/codeheart/turtle/turtle.min.js?">-*- javascript -*-</script>
  <script type="text/javascript" src="index.js"></script>
  </body>
</html>
result
console
?