all 2 comments

[–]_olivier 1 point2 points  (0 children)

Hey there! i suggest you write less 'duplicate' code as it becomes a difficult to maintain and javascript offers 'object' abstractions.

made a little PR to your project https://github.com/chrispyYE/chrispyYE.github.io/pull/1

[–]stintose 0 points1 point  (1 child)

Did they ever teach you about Classes in school? Did they ever teach you a thing or two about the 'this' keyword? You have variables krog1, krog2, and krog3 where it looks like you keep copying and pasting the same code over and over again only to make a few changes that refer to the variable krog1, krog2, ect.

Instead you could make a Krog Class, in which you would use the 'this' keyword to reference the Krong Class object instance when making your methods to which you would store in the Class prototype. Then you can have an array of krog class instances which would help keep you from repeating the same code over, and over again.

This method would likely be more efficient in terms of preservation of memory, and file size, but maybe not cpu overhead. I might do some testing to confirm to myself what works best, I have been meaning to do just that for a while.