Add JavaScript to single post

One option would be to create a shortcode exclusively for that script. Even thought it’s not an elegant solution, it works. In your functions file (functions.php) of your theme add:

function custom_script_shortcode(){
    $code="<script>";
    $code .= 'var foo = "bar";'
    $code .= '</script>';
    return $code;
}
add_shortcode("custom_script_shortcode", "custom_script");

And in your post editor then add the shortcode:

[custom_script]

Just be careful when you assign your JavaScript to the variable $code so you don’t close the string with ” or ‘