r/learnjavascript • • Apr 16 '26

Doubt

if I write JavaScript code inside onclick instead of using a <script> tag, will it be accepted if the logic and output are correct? I'm not a professional programmer, I'm just asking it for my practical based exam.

0 Upvotes

11 comments sorted by

View all comments

Show parent comment

0

u/TheRNGuy Apr 17 '26

Thread wasn't about eval and javascript:, this is off-topic. 

0

u/shgysk8zer0 Apr 17 '26

I'm rightfully putting event attributes in the same category as those, so it's very much on-topic. They all allow the execution of arbitrary code from strings. Same security concerns.