[1] https://github.com/S-poony/Ultra-Square-Catcher-USC-/blob/ma...
[1] https://github.com/S-poony/Ultra-Square-Catcher-USC-/blob/ma...
Our company needed an internal tool, and they wanted remote access to it, but it was basically just a tool to generate a file based on a few inputs. We already had a command line program for it, so I wrapped it up in a web server and had it take input as a form input without any JS. It worked great for years, and then someone got tasked with updating it (mostly just combining it with other tools). He couldn't figure out how it worked, so he rewrote it to use a ton of JS, using Angular and other stuff. And guess what? He took longer to rewrite it than I spent the first time and made no functional changes besides some CSS and a ton of JS.
With all these fancy new frameworks and browser features, it seems that many developers have forgotten (or never learned) how to do things simply. Frameworks and browser features have their place (I built an interactive HTML5 app as my first project at that company), but they're often completely unnecessary.
If you need a one-off page that does a little dynamic stuff? Drop in jquery+bootstrap and a little wiring js and be done with it. Not a huge fan of the size of jquery + bootstrap, but it's a fast path to done depending on your one-off needs.
1. There are two functions called "distance" and they're identical. Only the outermost appears to be needed.
2. As written, the game places variable and function names into the global scope. It doesn't matter for this game, but will be a problem for larger games. One idea would be to use the Immediately Invoked Function Expression (IIFE) pattern [1]. Another would be to take advantage of ES6 modules[2] (<script type="module">) to limit variable scope.
[1] https://developer.mozilla.org/en-US/docs/Glossary/IIFE
[2] https://www.contentful.com/blog/2017/04/04/es6-modules-suppo...
Still a very good job for just a week of coding though.
Modern JS engines optimize hot functions at runtime - advice like this won't affect actual performance.
I was more thinking of Assassin's Creed and Far Cry when I wrote that comment.
Another example would be memory allocation/freeing in a non-GC language. Sure, it’s a pain that I have to deal with it, but it’s still on me to make sure my application works in the language I’ve chosen and doesn’t leak memory all over the place.
This person has been programming for a week. I think we can let this slide
I don't get to write crap code at my work if I'm inexperienced, I have to learn to write good code.
Don't want to be the killjoy here but isn't line 77-79 the same as 85-87? With the rest I can agree.