Bytes #33 - Big Tech has established an over-leveraged short position in Backbone.js

Big Tech has established an over-leveraged short position in Backbone.js

Issue #33.February 1, 2021.2 Minute read.

Hear me out. I have reason to believe Big Tech has established an over-leveraged short position in Backbone.js. If we all migrate to Backbone.js and refuse to ever migrate off, it'll create a massive short squeeze on their tech debt that they won't be able to recover from. #💎✋

Hot or Not? -- ES2021 Edition


When you finally make it into the Spec

Coming soon to an IDE near you: ECMAScript 2021 / ES12 / Nü-Script (k, we made that up). The latest version of JavaScript is all set to be released in June, and we'll see five TC39 proposals finally get their wings and be officially added to the Spec.

Quick review on TC39 process: Proposals go through a 5-stage process (numbered 0-4, because of course it is), with each stage requiring an additional level of approval and commitment from members of the TC39 committee. The amount of time required to clear all 5 stages can vary widely -- some proposals are approved in months, others get stuck on one or more stages for years at time (kinda like a game of Phase 10 from hell).

We'll run through all five new features and give each one a hotness rating on a scale of 1-5 🔥. Why? Because we've been watching too much Bachelor/Bachelorette in quarantine like everybody else.

  • Promise.any() -- This new method for promise will resolves if any one of the supplied promises are resolved. 🔥 Rating: 2/5 -- I'm sure there are some fantastic use cases for this that one of the 80,000 of you will tell me about while also being upset it only got a 2, but I can't think of any.

  • WeakRef -- Typically, references to objects in JavaScript are "strongly held," which just means that if you have a reference to the object it won't be garbage-collected. WeakRef is a new class that lets you create weak references to objects, AKA references that won't stop the referenced objects from being garbage-collected. The main use case for this would be to implement caches or mappings to large objects. 🔥 Rating: 3/5 -- Pretty cool in theory, but you'll probably never use it in practice.

  • String's replaceAll() Method -- Lets you replace all occurrences of a string with another string value; kinda like "Find and Replace" in Microsoft Word. 🔥 Hottness Rating: 3/5 -- Not ground breaking, but on more than one occasion I've been upset that replace only actually worked on the first occurrence.

  • Logical assignment operators -- This feature was ~~lifted from~~ inspired by Ruby, and it combines logical operations (&&, || or ??) with assignment (a ||= b, a &&= b, a ??= b). There's a lot more to explain here, but we're running out of space. 🔥 Rating: 4/5 -- Combining two concepts into one new feature like this is pretty exciting.

  • Numeric separators -- Helps make numeric literals more readable by using _ to create a visual separation between groups of digits. So instead of let billion = 1000000000, you can do let billion = 1_000_000_000. 🔥 Rating: 5/5 -- No more squinting and counting the digits with your cursor 4 times to make sure you got it right??? We're smokin' meats now!

The Bottom Line

Remember the days when we'd get new JavaScript features every 5 years? Glad we figured that out.

/r/JavaScript becomes an angsty teen

JS Bets

Which framework are we pumping today, folks?

The subreddit that everyone's talking about... /r/JavaScript (obvi), turned 13 years old last week! When John Resig (creator of JQuery) started the subreddit back in January 2008, it was just a few web OG's posting random JavaScript links. Today it's up to 1.4 million members who... mostly post random JavaScript links.

To commemorate the milestone, here are a few r/JavaScript highlights through the years.

  • The first post: A list of job openings for JavaScript, JQuery, and Ajax developers, posted by John Resig. Not sure if these folks are still hiring, but if you're looking for a killer Ajax role, it might be worth reaching out via the hotmail email address they listed in the description.

  • The most upvoted post: A fun gif that uses two coffee cups to demonstrate the difference between pass by reference and pass by value. Posted 3 years ago by u/mburakerman.

  • The most commented-on post: "Nobody talks about the real reason to use Tabs over Spaces" by u/ChaseMoskal, predictably had a lot of people ready to fight to the death in the comments for their beliefs.

Look how far we've come, together 💖.

🔥 Tip - Get the current URL in JavaScript

function getCurrentURL () {
  return window.location.href

// Example
const url = getCurrentURL()

url //

Simple enough. If you're using JavaScript in the browser you can get the full current URL by using window.location.href. I think it's also worth noting that window.location has a bunch of different properties on it that may be of use to you as well.

Let's assume this is the current URL we're on

These are all the properties that window.location gives us.

const {
  host, hostname, href, origin, pathname, port, protocol, search
} = window.location

host // ""
hostname // "ui"
href // ""
origin // ""
pathname // "/get-current-url-javascript/""
port // ""
protocol // "https:"
search // "?comments=false"

Cool Bits

  1. Last week, we made a joke about how "AnimeXYZ would be a great name for an animation library that makes a tiny Naruto run across the bottom of your screen every time a new page loads." And in a matter of hours, I was reminded why we have the best readers on the planet. I present to you a fully-functioning AnimeXYZ -- courtesy of Jordan Gardner.

  2. Dave Geddes wrote about how to practicie CSS like an artist. That's cool, but don't you think Michelangelo could've painted the Sistine Chapel wayyyy faster using a cookie-cutter Bootstrap template?

  3. RunJS is a JavaScript/TypeScript playground desktop app that seems to be pretty universally-loved and had the foresight to make a fantastic promo video all the way back in 2015.

  4. TOAST UI Chart just released v4.0 of its chart library. This should make it easier than ever to track your portfolio, especially when you consider the fact that stonks only go up 💎🤲.

  5. Dave Plummer -- a retired OS engineer from Microsoft made an awesome video on the secret history of Windows bluescreens, which answers the age-old question, "why are blue screens blue?"

  6. Brian wrote a fantastic post on building futuristic UIs (like the ones you see in Sci-Fi movies) for the web today. He also created a live demo, if you're feeling ready to fully enter the Matrix.

  7. Fireship made a great video breaking down all of the AWS vs. Elasticsearch drama. TL;DR -- everyone loses, except Amazon (like always).

  8. Stackshare just released their list of top 100 developer tools for 2020, which seems weird considering it feels like 2020 ended like 8 months ago. Congrats to this guy for taking the top spot (again).

Join Bytes

Delivered to 70,048 developers every Monday