• 0 Posts
  • 500 Comments
Joined 8 months ago
cake
Cake day: November 14th, 2023

help-circle






  • Victor@lemmy.worldtoProgrammer Humor@programming.devJavaScript
    link
    fedilink
    arrow-up
    38
    arrow-down
    1
    ·
    edit-2
    7 days ago

    In node, I get the same result in both cases. "[object Object]"

    It’s calling the toString() method on both of them, which in the array case is the same as calling .join(",") on the array. For an empty array, that results in an empty string added to "[object Object]" at either end in the respective case in the picture.

    Not sure how we’d get 0 though. Anybody know an implementation that does that? Browsers do that maybe? Which way is spec compliant? Number([]) is 0, and I think maybe it’s in the spec that the algorithm for type coercion includes an initial attempt to convert to Number before falling back to toString()? I dunno, this is all off the top of my head.







  • I don’t think it’s lane surfing if you’re not changing lanes.

    No, definitely not. It’s only lane surfing if you’re changing lanes to pass. Sorry, I thought that was the implication.

    Anyway, this comment section has made me realize that it always just depends. Drive aware, keep safe distance, don’t unnecessarily change lanes, let people pass (on the left) if they’re going faster than you, etc.

    Yes, agree completely. ❤️

    The best advice I ever got about driving was “be predictable.” I think if anyone really takes that to heart empathetically then it would be safer.

    Exactly. That person understands traffic. So many times people will decelerate very rapidly to stop and give way for me (because it’s a place where they are supposed to). But because they are coming at such speed, it doesn’t look like they’ll stop in time and it makes me react by breaking suddenly.

    People need to look far, and break early and slowly. Be predictable and have clear car body language.

    👌👌 You and I are on the same page.