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

help-circle




  • Victor@lemmy.worldtoProgrammer Humor@programming.devJavaScript
    link
    fedilink
    arrow-up
    35
    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.















  • It was quite long. This is what I could find at the end while skimming again.

    I asked if they thought education would be improved on campus if phones were forcibly locked away for the duration of the school day. Only one student gave me so much as an affirmative nod!

    Among students, the consensus was that kids generally tune into school at the level they care to, and that a phone doesn’t change that. A disinterested student without a phone will just tune out in some other way. They also put forth the idea that the quality of the teacher has a lot to do with how much they’ll tune in. This take had broad support.

    🤷‍♂️ If it’s a problem or distraction it’s gotta go away. But of course it’s not the only factor. I didn’t grow up with notifications in class but I was very distracted still. But a phone would not have helped me, let’s just say that.