I came across a site named “FurAffinity“, and was toying around with userscripts. I discovered something strange with while being on that site that this JS code does not work (it happens on both on a userscript, and on the devtool’s console):
Array.from(new Set([1,2,2,3]))
// returns "[]" instead of "(3) [1, 2, 3]"
Entering that code on the default page of the browser (appears when you create a new tab) will do the latter result as expected, but not while on FurAffinity.
Is there any explanation of why this occurs? If so, is there any way to re-override it to do the default array method? Also if so, is there any way to prevent websites from overriding any JS methods of the userscript? I already know you can convert a set into an array using a spread syntax ([...ExampleSet]
) as a workaround, however I’m concerned about other commonly-used JS methods and functions like String.<Insert method name here>
and /<regex>/.test(String)
could get altered and not behave as it supposed to do.