get_current_screen() return null

get_current_screen is an Admin API, it can’t be used on the frontend, only in /wp-admin screens.

If you want to run javascript code only on certain pages, either enqueue it on those pages, or load it on all pages and check the body classes, or many other methods. get_current_screen is not the way to do it.