JavaScript in WordPress Customizer

This is because you are using wp_kses_post to sanitize the output data, try without it:

<?php echo get_theme_mod( 'script-code'); ?>

also remove it from here:

$wp_customize->add_setting (
    'script-code',
    array (
        'default' => esc_html__( 'Script Code', 'x' ),
        'sanitize_callback' => '' // remove wp_kses_post
    )
); 

also make sure you are using the right name of your theme mod you can check that in two ways:

1.- do a var_dump(get_theme_mods()); check there how is named.

2.- Inspect the HTML code of your control in the customizer

enter image description here

the id without the prefix customize-control- is the name of your theme mod.