Load site modules...
lade...
random avatar

michaelbradley - Network

Posts Subscribe

Okay, I think I get it now. []-0 = 0 because the empty array is coerced into the number 0 giving Number([])-0 = 0-0 = 0.{}-0 = -0because in...

https://mstdn.ca/@michaelbradley...

Okay, I think I get it now. []-0 = 0 because the empty array is coerced into the number 0 giving Number([])-0 = 0-0 = 0.

{}-0 = -0because in this is context the braces don't evaluate to the empty object, but rather an empty code block which is dropped, leaving just -0.

console.log is irrelevant, what matters is that a semantic block cannot be inside parentheses so the braces must now be interpreted as an empty object, giving ({}-0) = Number({})-0 = NaN-0 = NaN.

5.12.2024 21:39Okay, I think I get it now. []-0 = 0 because the empty array is coerced into the number 0 giving Number([])-0 = 0-0 = 0.{}-0 = -0because in...
https://mstdn.ca/@michaelbradley...

A few questions:Why does {}-0 evaluate to -0, instead of regular 0 like []-0?Why does adding parentheses around the empty object make it...

https://mstdn.ca/@michaelbradley...

A few questions:

  1. Why does {}-0 evaluate to -0, instead of regular 0 like []-0?
  2. Why does adding parentheses around the empty object make it evaluate to NaN?
  3. Why does putting {}-0 inside a console.log suddenly make it evaluate to NaN?

For context: 0-0 evaluates as 0 (not -0), console.log(-0) outputs -0 (not NaN), and this behaviour is the same in Chromium. You would expect this to be true anyways, but you can never be sure with these sorts of edge cases.

18.11.2024 20:50A few questions:Why does {}-0 evaluate to -0, instead of regular 0 like []-0?Why does adding parentheses around the empty object make it...
https://mstdn.ca/@michaelbradley...

Was messing around in the Firefox console today and found this, any #javascript experts want to explain what type coercion magic is going on...

https://mstdn.ca/@michaelbradley...

Was messing around in the Firefox console today and found this, any experts want to explain what type coercion magic is going on here?

[]-0    // 0
{}-0 // -0
([])-0 // 0
({})-0 // NaN

console.log([]-0) // 0
console.log({}-0) // NaN
console.log(([])-0) // 0
console.log(({})-0) // NaN

18.11.2024 20:41Was messing around in the Firefox console today and found this, any #javascript experts want to explain what type coercion magic is going on...
https://mstdn.ca/@michaelbradley...

:3

https://mstdn.ca/@michaelbradley...

:3

5.8.2024 02:24:3
https://mstdn.ca/@michaelbradley...

MEGA recently updated their method of ignoring files in synced directories, but it looks like they forgot to migrate my old settings to the...

https://mstdn.ca/@michaelbradley...

MEGA recently updated their method of ignoring files in synced directories, but it looks like they forgot to migrate my old settings to the new system. I've added a bunch of stuff to my new .megaignore file that will hopefully be enough to stop it from syncing all of my virtual environments 🙃

20.3.2024 22:05MEGA recently updated their method of ignoring files in synced directories, but it looks like they forgot to migrate my old settings to the...
https://mstdn.ca/@michaelbradley...

Just realized I’ve now been on Mastodon for over a year, and I’ve settled into a nice rythm of checking my feed a couple times a day....

https://mstdn.ca/@michaelbradley...

Just realized I’ve now been on Mastodon for over a year, and I’ve settled into a nice rythm of checking my feed a couple times a day. It’s nice because it scratches the itch of getting news and opinions, but doesn’t keep me addicted and procrastinating 24/7.

22.1.2024 09:08Just realized I’ve now been on Mastodon for over a year, and I’ve settled into a nice rythm of checking my feed a couple times a day....
https://mstdn.ca/@michaelbradley...

As I've become more familiar with web development I've come to realize that at least 95% of layout problems (conservatively) can be solved...

https://mstdn.ca/@michaelbradley...

As I've become more familiar with web development I've come to realize that at least 95% of layout problems (conservatively) can be solved with flexbox.

25.7.2023 19:27As I've become more familiar with web development I've come to realize that at least 95% of layout problems (conservatively) can be solved...
https://mstdn.ca/@michaelbradley...

π

https://mstdn.ca/@michaelbradley...

π

22.7.2023 17:27π
https://mstdn.ca/@michaelbradley...

The road leading up to my cottage is incorrectly marked by Apple and Google Maps. I went to @openstreetmap to see if I could mark it...

https://mstdn.ca/@michaelbradley...

The road leading up to my cottage is incorrectly marked by Apple and Google Maps. I went to @openstreetmap to see if I could mark it properly, assuming that the OSM data would eventually make its way to Apple/Google, and found that OSM already had this tiny road out in the middle of nowhere marked properly :)

18.7.2023 13:13The road leading up to my cottage is incorrectly marked by Apple and Google Maps. I went to @openstreetmap to see if I could mark it...
https://mstdn.ca/@michaelbradley...

Happy #tauday! 6.28 is the best date approximation of τ out of all the {mm}.{dd} or {dd}/{mm} pairs, but make sure to celebrate π day next...

https://mstdn.ca/@michaelbradley...

Happy ! 6.28 is the best date approximation of τ out of all the {mm}.{dd} or {dd}/{mm} pairs, but make sure to celebrate π day next month on 22/7!

28.6.2023 21:56Happy #tauday! 6.28 is the best date approximation of τ out of all the {mm}.{dd} or {dd}/{mm} pairs, but make sure to celebrate π day next...
https://mstdn.ca/@michaelbradley...

If you're microwaving leftovers with cheese, it's always best to just nuke them.The cheese must flow.

https://mstdn.ca/@michaelbradley...

If you're microwaving leftovers with cheese, it's always best to just nuke them.

The cheese must flow.

14.6.2023 03:45If you're microwaving leftovers with cheese, it's always best to just nuke them.The cheese must flow.
https://mstdn.ca/@michaelbradley...

Just filled in my mail-in ballot for the #toronto mayoral by-election. Always make sure to vote! Not saying who I voted for though, do your...

https://mstdn.ca/@michaelbradley...

Just filled in my mail-in ballot for the mayoral by-election. Always make sure to vote! Not saying who I voted for though, do your own research ;)

7.6.2023 03:19Just filled in my mail-in ballot for the #toronto mayoral by-election. Always make sure to vote! Not saying who I voted for though, do your...
https://mstdn.ca/@michaelbradley...

With Reddit down, this is the most productive I’ve been in a long time.

https://mstdn.ca/@michaelbradley...

With Reddit down, this is the most productive I’ve been in a long time.

14.3.2023 22:06With Reddit down, this is the most productive I’ve been in a long time.
https://mstdn.ca/@michaelbradley...

Don’t get mad at people for things they haven’t done yet.

https://mstdn.ca/@michaelbradley...

Don’t get mad at people for things they haven’t done yet.

3.3.2023 06:05Don’t get mad at people for things they haven’t done yet.
https://mstdn.ca/@michaelbradley...

Wishing for more nuance in people's opinions. Remember that there's a person on the other side of the screen. https://xkcd.com/2112/

https://mstdn.ca/@michaelbradley...

Wishing for more nuance in people's opinions. Remember that there's a person on the other side of the screen. xkcd.com/2112/

11.2.2023 19:33Wishing for more nuance in people's opinions. Remember that there's a person on the other side of the screen. https://xkcd.com/2112/
https://mstdn.ca/@michaelbradley...

don’t let perfect be the enemy of good, but also don’t let “don’t let perfect be the enemy of good” be the enemy of better

https://mstdn.ca/@michaelbradley...

don’t let perfect be the enemy of good, but also don’t let “don’t let perfect be the enemy of good” be the enemy of better

25.1.2023 01:26don’t let perfect be the enemy of good, but also don’t let “don’t let perfect be the enemy of good” be the enemy of better
https://mstdn.ca/@michaelbradley...

Not sure what to use this account for because I don’t personally know anyone else on here but I’ve tied my name to it so I have to keep...

https://mstdn.ca/@michaelbradley...

Not sure what to use this account for because I don’t personally know anyone else on here but I’ve tied my name to it so I have to keep this somewhat normal.

25.1.2023 01:26Not sure what to use this account for because I don’t personally know anyone else on here but I’ve tied my name to it so I have to keep...
https://mstdn.ca/@michaelbradley...
Subscribe
To add news/posts to your profile here, you must add a link to a RSS-Feed to your webfinger. One example how you can do this is to join Fediverse City.
         
Webfan Website Badge
Nutzungsbedingungen   Datenschutzerklärung  Impressum
Webfan | @Web pages | Fediverse Members

⬆️

⬇️