There is a WordPress function that was originally intended for passing translations but now is commonly used for passing any required content from PHP on the server to JS on the front end, namely wp_localize_script (https://codex.wordpress.org/Function_Reference/wp_localize_script).
However, it might be simpler in this case, depending on how you are adding the JavaScript.
Say you have a Content Template for some post type, and you want to add the JavaScript to this template.
Instead of using the custom JS editor section, you could add your code directly in the content editor in script tags that will appear in the markup of your page. Which means you can use shortcodes in your JS code, something like:
$("#price-range").slider({
// maximum value
max: [wpv-view name="highest-number"],
...