Avothr Avothr - 1 year ago 134
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() ?

Answer Source

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

console.log(typeof close);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download