Share something you learned recently (that changed the way you think)

#1

They say you learn something new every day. What have you learned recently?

Today, I learned that a finally block in Javascript will execute regardless of an early return statement in the try or catch blocks. I know, it seems basic, but it’s not something that came up for me before.

1 Like
#2

I’ve been writing CSS for a long time but I recently discovered that browsers read selectors from right to left rather than the intuitive left to right. I previously thought I was “scoping” my styles by doing something like this.

nav a

I thought browsers would hone in on the <nav> element then find all the child <a> tags. But it turns out browsers start by looking at all the <a> tags then check to see if they have a <nav> parent.

This misunderstanding has performance implications if you have a large document and a ton of poorly written selectors. Luckily, I haven’t really noticed any ill effects in the wild since modern browsers are pretty damn amazing.

But now that I know this, I’ll at be a little more thoughtful in my selectors and consider adding a class to the last element. It could look something like this.

nav a.button

I do think this has the potential to make HTML less readable if you’re throwing in redundant classes just to optimize selectors. Things like <a class="link" /> just seems absurd to me. Maybe it’s better to not have classes on the last element in a lot of cases…I’m torn. But this does give me a new appreciation for things like BEM even though I find the syntax to be so noisy.

1 Like
#3

I just starting brainstorming about UBI (universal basic income) and it really might be the solution and with a smart decentralized system it could be done

2 Likes
#4

@c0dr welcome to the Hacker Noon community forum! :smiley: You might like this thread, if you’re interested in UBI: Automation and the future of unemployment

As for something that’s changed the way I think recently, since it’s been a couple months…I took a trip to London with the rest of the full-time Hacker Noon team for an event, and to get together and work together in person as we do once per quarter, and what really blew my mind was the efficiency of London’s public transit system. I had experienced the Detroit bus system (basically no public transport) and the San Francisco Bay Area’s train/bus system (some public transit, but not great). What blows my mind is that:

  1. There are digital signs at the bus stations showing the times of the bus arrivals. This doesn’t seem like much, but compared to Detroit, it’s a godsend.
  2. The Oyster card is super easy to use (basically like the Clipper cards in the Bay Area).
  3. When a bus has to stop to even out the service, they actually tell you why there’s a delay (in Detroit, it’s like, “Are you riding or not? Don’t like it? Get off.”).
  4. The whole system is much safer than Detroit’s buses, even those in the suburbs of Detroit.
  5. London’s system goes everywhere. In the Bay Area, it’s limited, and in Detroit, there’s a complete, intentional, racially-driven disconnect between the Wayne county bus system (mostly black) and the Macomb and Oakland county bus systems (mostly white). Detroit is so racially divided, it’s maddening. I’ll be glad to get out.

Overall, I’m just enchanted with the UK right now, as far as public transit and safety goes. And it’s got me itching to explore the rest of Europe.

1 Like