![New JavaScript learner here: why must the if statement be inside the onclick function for the alert to appear? : r/learnjavascript New JavaScript learner here: why must the if statement be inside the onclick function for the alert to appear? : r/learnjavascript](https://preview.redd.it/plhyxl12syt71.jpg?width=640&crop=smart&auto=webp&s=9c52021dbb3620f4b71afa0167edef07c31eb43d)
New JavaScript learner here: why must the if statement be inside the onclick function for the alert to appear? : r/learnjavascript
![Stepping out into an HTML 'onclick' attribute shows the HTML file with an unexpected highlight · Issue #7293 · firefox-devtools/debugger · GitHub Stepping out into an HTML 'onclick' attribute shows the HTML file with an unexpected highlight · Issue #7293 · firefox-devtools/debugger · GitHub](https://user-images.githubusercontent.com/132260/48644712-567af680-e998-11e8-85e5-b4ef74385eef.png)
Stepping out into an HTML 'onclick' attribute shows the HTML file with an unexpected highlight · Issue #7293 · firefox-devtools/debugger · GitHub
![browser - Onclick is not a reserved word. So how does javascript know to associate a function called onclick with a click event - Stack Overflow browser - Onclick is not a reserved word. So how does javascript know to associate a function called onclick with a click event - Stack Overflow](https://i.stack.imgur.com/04iQA.png)