Random walk.js KA

In this example below you will see how to do a Random walk.js KA with some HTML / CSS and Javascript

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

  <meta charset="UTF-8">
  <title>Random walk.js KA</title>



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



/*Downloaded from https://www.codeseek.co/120hit/random-walkjs-ka-xLqNLE */
/* i am learning from khanacademy and this is an natural simulation code example*/
/* in this first code we are defining the Walker as a object type, which then needs 2 data points
first data is the x-location next is the y-location*/
var Walker = function() {
  this.x = width/2;
  this.y = height/2;

/* next - our walker object will have a method that we can call on it. First method allows the object to display itself as a black dot. a code called prototype is needed to add methods to a function*/

Walker.prototype.display = function() {
  point(this.x, this.y);