I have a strange situation that my $(document).ready(function(){ script is loaded for my usernamecheck and emailcheck but also not for my Unify 2.1 script.
In the following example you see both script were after 2 days searching I still haven't found anything and I run out of clues
Working example: https://gitaartabs.nl/templates2/unify-main/shortcodes/promo/gitaartabs-backup.php But at my homepage with other menu's it isn't: https://www.gitaartabs.nl/homev41
Hope s.o. can help. Jan
$javascripts = array("
$(document).ready(function(){
        // initialization of carousel
        $.HSCore.components.HSCarousel.init('.js-carousel');
         // initialization of carousel e-book
        $('#carousel3').slick('setOption', 'dots', true, true);
        $('#carousel3').slick('setOption', 'dotsClass', 'js-pagination u-carousel-indicators-v30 g-pos-abs g-top-0', true);
        $('#carousel3').slick('setOption', 'customPaging', function (slider, i) {
          var title = $(slider.).data('title');
          return '<i class="u-dot-line-v2 g-brd-gray-light-v2--before g-brd-gray-light-v2--after g-mb-15--sm"><span class="u-dot-line-v2__inner g-bg-white--before g-brd-3--before--active g-brd-gray-light-v2--before g-brd-primary--before--active g-transition--ease-in g-transition-0_2"></span></i><span class="hidden-sm-down g-color-black g-font-size-15">' + title + '</span>';
        }, true);
      $(window).on('load', function () {
        // initialization of header
        $.HSCore.components.HSHeader.init($('#js-header'));
        $.HSCore.helpers.HSHamburgers.init('.hamburger');
        // initialization of HSMegaMenu component
        $('.js-mega-menu').HSMegaMenu({
          event: 'hover',
          pageContainer: $('.container'),
          breakpoint: 991
        });
");
Updates: I use php and my index.php use the script below.
//include javascripts array()
if(count($javascripts) > 0) {
    foreach($javascripts as $javascript) {
        echo "\n\t<script>".$javascript."</script>"; 
    }
}
Perhaps I need to backslash the $slides[i] ? within this code?
  var title = $(slider.$slides[i]).data('title'); 
 
    