Display images from JS?

You don’t specify how precisely your JS is output. If you are doing this inline from PHP you could just echo required data in place.

If it’s just some arbitrary script, loaded as such, then the common practice in WP is to use wp_localize_script() to pass data from PHP runtime to an enqueued script.

While by initial purpose (and name) the function was meant for localization, it handles arbitrary data just fine.