One runs in the frontend (ie. when a user visits your website this code runs in the user’s web browser) and the other on the backend (ie. when a user does something on your site the code executes on a Wix server, not the user’s computer).
Some functions are intended to only be used on one or the other.