wp_enqueue JavaScript in child-theme (ReferenceError) using Search & Go

I enqueued the child script the right way and made the first Reference Error (eltdGlobalVars) disappear as follows:

In functions.php in child I removed lines that dequeue the script “search_and_go_elated_listing”. Then I enqueued it using a copy of the function with the same name as the pluggable function in parent: “search_and_go_elated_listing_assets”. Within this copy I modified the location of script to location in childtheme and I made sure to recognize the handle, adding “child_” to it.

It looks like this:

function search_and_go_elated_listing_assets() {

    wp_enqueue_style( 'search_and_go_elated_listings', ELATED_ASSETS_ROOT.'/css/listings.css' );
    wp_enqueue_script( 'child_search_and_go_elated_listings', get_stylesheet_directory_uri() . '/assets/js/listings.js', array('jquery', 'underscore', 'jquery-ui-autocomplete'), false, true );

    if(search_and_go_elated_is_responsive_on()) {
        wp_enqueue_style( 'search_and_go_elated_listings_responsive', ELATED_ASSETS_ROOT.'/css/listings-responsive.min.css' );
    }
}
add_action( 'wp_enqueue_scripts', 'search_and_go_elated_listing_assets' );

Then I also copied the pieces of script were “search_and_go_elated_lising” is mentioned, changing it’s handle to “child_search_and_go_elated_lising”. In example below in combination with the variable GlobalVars, menioned in the original error:

function search_and_go_elated_get_global_variables() {

    $global_variables = array();
    $element_appear_amount = -150;

    $global_variables['eltdAddForAdminBar'] = is_admin_bar_showing() ? 32 : 0;
    $global_variables['eltdElementAppearAmount'] = search_and_go_elated_options()->getOptionValue('element_appear_amount') !== '' ? search_and_go_elated_options()->getOptionValue('element_appear_amount') : $element_appear_amount;
    $global_variables['eltdFinishedMessage'] = esc_html__('No more posts', 'search-and-go');
    $global_variables['eltdMessage'] = esc_html__('Loading new posts...', 'search-and-go');

    $global_variables = apply_filters('search_and_go_elated_js_global_variables', $global_variables);

    wp_localize_script('child_search_and_go_elated_modules', 'eltdGlobalVars', array(
        'vars' => $global_variables
    ));

}

add_action('wp_enqueue_scripts', 'search_and_go_elated_get_global_variables');

Second Reference Error (eltd) is solved by rightly prioritizing the actions adding the scripts. This is obvious now I understand it: Make sure that variables are defined before they are referenced!

Since I’m enqueueing several scripts in functions.php in child the other might have been changed with respect to the parent. So in order to solve the reference error in listings.js I made sure it was enqueued later than the other scripts (later than modules.js to be specific).