Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?

wp_localize_script is the “WordPress way” to pass data from php to javascript. See this post by Otto for more info.