JavaScript file successfully registered but does not render correctly

You were using action to enqueue script, instead you need to use filter hook. As, you are adding a new script to the scripts call.

However, if you used action hook for the wp_head call it works there.

<?php
    add_filter('wp_enqueue_scripts', 'colorboxJS');
    function colorboxJS() {
        wp_enqueue_script(
            'colorbox', 
            get_stylesheet_directory_uri() . '/colorboxJSfile.js', 
            array('jquery')
        );
    }
?>