Today I was implementing a click listerener and stumbled on the following:
function click (val) {
console.log(val)
}
function random (val) {
console.log(val)
}
div:hover {
background-color: blue;
cursor: pointer;
}
<div onclick="click(1)">test1</div>
<div onclick="random(1)">test2</div>
The method for handling events cannot be named 'click'. Click is not a reserved keyword like for
, if
or while
so why can't I use it? Are there any other function names which I cannot use?