get_current_screen() return null

I want to put JavaScript code on certain pages in frontend. But the output return null .

add_action( 'wp_footer', function () {      $  screen = get_current_screen();     var_dump( $  screen );  }, 999 );