Should I convert my inline script so I can put it into an external .js file?

Should I convert my inline script so I can put it into an external .js file?

I'm new to jQuery, and I have been using the SnapScroll jQuery plugin by koga73 (<a href="https://github.com/koga73/SnapScroll" target="_blank">https://github.com/koga73/SnapScroll</a>) in my webpage.

I'm new to jQuery, and I have been using the SnapScroll jQuery plugin by koga73 (https://github.com/koga73/SnapScroll) in my webpage.

It has requested me to use the inline script:

<script> 
var snapScroll = $("header, section, footer").SnapScroll({
hashes:true }); console.log(snapScroll);

$("header").on(snapScroll.eventChangeActive, function(evt, newActive){ console.log(evt, newActive); });

$(document).on(snapScroll.eventChangeVisible, function(evt, visibleList){ console.log(evt, visibleList.data); }); </script>

It's been working fine, but I was just wondering is it worth moving it into an external .js file, and if so, how do I convert the code to work in an external .js file?

My external js file is:

<script type="text/javascript" src="web/js/init.js"></script>


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Building a minesweeper game using Javascript, HTML and CSS

In this article, you'll learn how to build minesweeper using JavaScript, HTML and CSS. I also used jQuery, a JavaScript library that is helpful for interacting with html. Whenever you see a function call with a leading dollar sign, that is jQuery at work

Material Login & Signup Form with CSS, HTML and JavaScript

How we can create a login and signup form with the material design using HTML CSS JavaScript? Solution: See this CSS Material Login & Signup Form With jQuery, Material Design Form.

Bar Graphs with Animation using JavaScript, HTML, & CSS

How we can create Bar Graphs With Animation using JavaScript, HTML, & CSS? Solution: JavaScript Animated Bar Graph. In Other Words, Bar Chart With Animation Effects.