Conversation
Notices
-
Embed this notice
Piggo :verified_horse: (piggo@piggo.space)'s status on Saturday, 03-Feb-2024 02:44:00 JST Piggo :verified_horse: @domi @iacore wow i thought this shit is protected somehow but no it so is not -
Embed this notice
Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Saturday, 03-Feb-2024 02:43:59 JST Haelwenn /элвэн/ :triskell: @piggo @domi @iacore ⚠ Warning: I somehow bork my browser web process while doing this one, ended up in an infinite loop.
btw for some reason unknown to myself being a JS-noob, you need to use function() {} and not () => {}.
$ node > String.prototype.toString = function() { if(this == "meow") { return ":3"; } else { throw "tangled yarn"; } }; [Function (anonymous)] > "meow".toString() ':3' -
Embed this notice
alina 🌸 (teidesu@very.stupid.fish)'s status on Saturday, 03-Feb-2024 04:52:50 JST alina 🌸 @lanodan@queer.hacktivis.me @piggo@piggo.space @domi@donotsta.re @iacore@mastodon.de that happened because within your .toString, this refers to a String object, and since == is a "loosely equal" operator, it implicitly calls .toString to coerce it to a primitive, resulting in an infinite loop
and arrow function doesn't work because by definition arrow functions always use parent this, that's the main difference between them and function functions
something like this worksHaelwenn /элвэн/ :triskell: likes this. -
Embed this notice
Haelwenn /элвэн/ :triskell: (lanodan@queer.hacktivis.me)'s status on Saturday, 03-Feb-2024 04:55:37 JST Haelwenn /элвэн/ :triskell: @teidesu @domi @iacore @piggo Oooh right, JS loves implicitly casting data in just about any situation, which is something I just can't get used to.
-
Embed this notice