This will not make any difference to how your code works but will make your code neater and has much more potential for the future.

External JavaScript is available across many pages and keeps your HTML files smaller (just like external CSS).

Using addEventListener allows you to add event triggers in a much more clever and flexible way.

External JavaScript is a must for any real Web developer.  Using addEventListener is recommended.