What in the global is this

Javascript has a special variable called this, which points to the current execution context. The execution context is the environment a function or method is executed in. The value of this isn’t determined until run time. Since the same method or function can be executed in different contexts in the same program, the value of…

Closures ahead

In Javascript, when variables are defined in an outer scope, they’re accessible in any inner scope. When a function is defined, it forms a new scope. Variables defined in the outer scope are accessible inside, but not the reverse – variables defined in the inner scope are not visible outside it: Function scopes can be…

JS prototypes

In Javascript, objects store key/value pairs. The keys can be strings or symbols and values can be anything. A key with a function for a value is called a method. A value can also be another object. Key/value pairs in objects are called properties. An object can be used as the template for another object….

Since last post

Lots of things have happened since the last post. The ones that are relevant for here are that instead of continuing with freecodecamp, I signed up for Launch School. After spending over a year on it, I’m most of the way through the main courses. I’m almost ready to start the last one. Having a…

Some other projects

I haven’t worked on these in several months either. I made these for the fun of it. Floating particles Codepen link I made this one to see if I could. So far it’s my favorite project I’ve built. Many 1-unit mass particles orbiting several heavier particles, up to 1000-unit mass. The particles are attracted to…

FCC Data visualization Projects

It’s been a while since I worked on these, but I never shared them. FCC Leaderboard Codepen link This was my first React project using an API. It’s indefinitely broken since the API isn’t maintained any more. Rogue like dungeon crawler Codepen link This was kind of fun to make. It’s like a snake game…

FCC Advanced Front-end Projects

Javascript calculator Codepen link This was hard to get it so that you can’t input invalid button sequences.  Future improvements: Model as a state machine Try to make it look like the iOS unlock keypad Pomodoro clock Codepen link The idea is for it to a work timer. I used a div that rotates at…

FCC Intermediate Front-end Projects

Random quote generator Codepen link My version shows funny/scary George W. Bush quotes. I checked all the references before adding.  I think this one was intended to use an API, but I just hard-coded the quotes and sources as a big array. I had a background image, but the link had expired since I looked…

FCC ‘Advanced Algorithm Scripting’

After spending all day trying to make a few of these better, I wasn’t able to. I spent most of that time on symmetric difference trying for a different solution. For phone numbers, the hard part was getting the magic regex. For exact change, I couldn’t see a way to consolidate all the while loops….

FCC ‘Intermediate Algorithm Scripting’

I was able to improve a few of these. A regex made spinal case easier; in ‘drop it,’ you can do something similar with a ‘while(pop());’ destructor in c++; in ‘smallest common multiple,’ I switched the GCD function to a Euclidean algorithm from a brute-force one. I think the last one was the most improved;…