Learn OOP the fun way! Build a command line “Frogger” game

Step 1. Write a description of the problem

Step 2: Code!

> new Array(20)
[ <20 empty items> ]
> function Lane() {}
undefined
> Lane.prototype.makeLane = function() {
console.log('example');
}

ƒ () {
console.log('example');
}

> Lane.prototype
{makeLane: ƒ, constructor: ƒ}
We know that the board looks approximately like the image, and we want to move Frogger up and down and left to right.
let array = [
0: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
1: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
2: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
3: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
4: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
5: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
6: [0,1,2,3,4,5,6,7,8,✅,10,11,12,13,14,15,16,17,18,19,20],
]

Lesson 4

Lesson 6

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store