Avothr Avothr - 7 months ago 54
Javascript Question

JavaScript function close() {}

I've created a function in JS named close

function close() {...}

and have an onclick call


but it won't work. If I rename the function to whatever, it works. Could it be that it is forbidden to use a function in JS named close() ?


close is a method of window. Like all objects from window, you can call it without window prefix.

console.log(typeof close);