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

I'm trying to solve a portswigger lab ( 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:

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: