Javascript Ch. 2
Things learned today:
- Word of the day: Paraprosdokian - A figure of speech in which the latter part of a phrase is surprising in a way that causes the listener to reinterpret the first part.
- Graph the ratings of any TV show on IMDB.
- React seems pretty simple to use- you basically just stick all of your HTML into React components. It is a more modular way of developing, which means that it makes a website more maintainable long term. However, it could be unnecessary for simple pages where you don’t want to invest in a server.
- Efficient approach to reservoir sampling (Taking a random sample from a large number of records).
- Deep links are links to specific pieces of content rather than homepages.
- GitLab is an alternative to GitHub if you want to self-host your content.
- Original call site is what matters for
this
binding in JS. - Hard binding is a form of explicit binding that allows you to force a function call to use a particular object for
this
binding. It’s a built in utility as of ES5. Summary ofthis
binding rules here. - Currying is when you break down a function that takes multiple arguments into a series of functions that take part of the arguments. It enables higher order functions to be used much more effectively and concisely. If you plan to do this in Javascript, the safe way is to create a null object to use to avoid any problems with
this
. - It’s a common mis-statement that “everything in JavaScript is an object”. The simple primitives (string, boolean, number, null, and undefined) are not themselves objects. There are also constructed object versions of these, but using the literal form (primitive) is preferred. The engine will turn these into constructed objects for property/method access.