[-] Konlanx@feddit.de 76 points 1 year ago* (last edited 1 year ago)
[-] Konlanx@feddit.de 56 points 1 year ago

This is due to the default sorter in JavaScript sorting by the string value. The reason for that is that this won't create errors at runtime. Since JavaScript does not have types, this is the safest way of sorting.

This works:

const unsorted = [1, 100000, 21, 30, 4]
const sorted = unsorted.sort((a, b) => a - b) 
[-] Konlanx@feddit.de 42 points 1 year ago* (last edited 1 year ago)

Same the other way around. I (european) regularly read about "100 degrees weather" somewhere in the US and my first thought always is "damn, that's as hot as boiling water".

[-] Konlanx@feddit.de 66 points 1 year ago

What a great post. Thank you for sharing it and all the best for you!

[-] Konlanx@feddit.de 46 points 1 year ago

I have been adblocking on YouTube for as long as I remember. Personally I think it's unusable without an adblocker. What's the alternative? Because I am not suddenly going to pay for a platform that keeps getting worse all the time.

[-] Konlanx@feddit.de 54 points 1 year ago* (last edited 1 year ago)

A racing game that has a very nice track builder and is very open to modding. Its focus is on the individual driver and the time they achieve on a track.

Flying for hundreds of meters, drifting under water, going at high speeds through multiple loopings, sliding on ice and so much more is totally possible with Trackmania.

Try it, the base game is free and their pricing for online services and cups is totally fine.

[-] Konlanx@feddit.de 58 points 1 year ago* (last edited 1 year ago)

It's not. The default sorter does that, because that way it can sort pretty much anything without breaking at runtime. You can overwrite it easily, though. For the example above you could simply do it like this:

[3, 1, 10].sort((a, b) => a - b)

Returns: [1, 3, 10]

[-] Konlanx@feddit.de 77 points 1 year ago* (last edited 1 year ago)

JS !== Java

Try Javascript some day!

  • We have truthy and falsy! Empty string or null? Yeah, that's false!
  • Of course we can parse a string to number, but if it's not a number it's NaN!
  • null >= 0 is true!
  • Assign a variable with =, test type equality with == and test actual equality with ===. You will NEVER use the wrong amount of = anywhere, trust me!
  • Our default sort converts everything to string, then sorts by UTF-16 code. So yes, [1, 10, 3] is sorted and you are going to live with it.
  • True + true = 2. You know I'm right.

Try Javascript today!

[-] Konlanx@feddit.de 164 points 1 year ago

Both of them are used to transport mostly a single person at a time. Even the small one is too big.

[-] Konlanx@feddit.de 77 points 1 year ago

So, my grandfather has a smartphone and knows enough about it to call, send messages and most importantly, use the emergency contacts. My grandmother doesn't really understand the phone. One time I called them to say congratulations for her birthday and she didn't know how to hang up, so apparently she just put the phone down. I could hear them talk, saying that "he's become a good person, always remembers us" and the fact that I wasn't meant to hear that made it extremely meaningful to me.

[-] Konlanx@feddit.de 57 points 1 year ago

NASA has a super interesting explanation about it here: https://svs.gsfc.nasa.gov/4709

Probes have also been taking pictures: https://en.m.wikipedia.org/wiki/Far_side_of_the_Moon

I know you are joking, but it's super interesting to me, so I wanted to share something about it.

[-] Konlanx@feddit.de 46 points 1 year ago

You mean the people running big corporations and not giving a fuck about the environment, right?

view more: next ›

Konlanx

joined 1 year ago