Skip to content

Instantly share code, notes, and snippets.


alion02/bad.js Secret

Created Sep 20, 2018
What would you like to do?
// BAD PERFORMANCE - declaring a class every time the function is called, instead of once during setup
// Naturally, this can be solved by stuffing the class into the storage object, but that runs the risk of running into problems with closures for inexperienced developers
class SomeClass {
constructor(thing) {
this.thing = thing;
// ANNOYING ACCESS - not being able to pre-fill a variable, and having to access it via storage.varName instead of simply varName
if (storage.turnsPassed === undefined) {
storage.turnsPassed = 0;
// HIDDEN ARGUMENTS - having to go back to the spec to check out how something's named is a pain, and an additional pain if it's not named how you'd like
return opponent.dead ? "m" : "n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment