By using event handler with html onclick property yoy are still using JavaScript functions because that handler is still JS function. In future you may need to add more handlers or delete or change one which is really handy when using separate JavaScript event listeners. Also removing certain handler or all of them is easy using functions like removeEventListener. also reusability is awesome in separate file.
By using event handler with html onclick property yoy are still using JavaScript functions because that handler is still JS function. In future you may need to add more handlers or delete or change one which is really handy when using separate JavaScript event listeners. Also removing certain handler or all of them is easy using functions like removeEventListener. also reusability is awesome in separate file.
but @wick3drose is also right, for a very small project that didn't need any other handlers, Beginner can use that