Javascript window object, window+”, what does this code do

I'm trying to solve a portswigger lab (https://portswigger.net/web-security/cross-site-scripting/contexts/lab-javascript-url-some-characters-blocked) and I can't understand why this code didn't pop up an alert when the expression window+'' is omitted:

x=x=>{onerror=alert; throw 1337},toString=x,window+''

A full explaination of this code snippet would be really appreciated, thanks.



Read more here: https://stackoverflow.com/questions/64416874/javascript-window-object-window-what-does-this-code-do

Content Attribution

This content was originally published by xr0t625 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: