why does alert() break code execution?

后端 未结 4 892
北荒
北荒 2020-12-11 02:38

When we use alert(), some times the code breaks.

For example:

HTML:

Hi

Javascript:

4条回答
  •  萌比男神i
    2020-12-11 02:59

    Using alert() stops all code execution. It would be impossible to capture a double-click if you are already capturing the single click on stopping code execution.

    To demonstrate, I've commented out the alert for the single click in your fiddle. You can see HERE that the alert now happens on the double click.

提交回复
热议问题