ReferenceError: Can't find variable: when I call a function (safari)
<p>I have the fallowing error :</p>

<blockquote>
  <p>ReferenceError: Can't find variable: changeImgSize</p>
</blockquote>

<p>But this is a function. I check if I correctly insert the different javascript files and it doesn't seem to have any problem. Here are my different files. Of course I will not show the whole code, just the part where the issue is</p>

<p><strong>index.html</strong></p>

<pre><code>&lt;!-- JQuery --&gt;
&lt;script src="build/jquery-3.1.0.min.js"&gt;&lt;/script&gt;

&lt;script src="js/imgManagement.js"&gt;&lt;/script&gt;
&lt;script src="js/MainFaceTracker.js"&gt;&lt;/script&gt;
&lt;script&gt;
       $(document).ready(documentIsReady); // 'documentIsReady' in 'no_language.js'
&lt;body&gt;
    &lt;input type="file" accept="image/*" id="input" /&gt;
&lt;/body&gt;
</code></pre>

<p><strong>imgManagement.js</strong></p>

<pre><code>function changeImgSize(img){
    // here i just change the size of the img with proportionality

    return img;
}

var addImgToCanvas = function(img){
    var canvas=$('#canvas');
    img=changeImgSize(img);
    var ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0, img.width, img.height);
};
</code></pre>

<p><strong>MainFaceTracker.js</strong></p>

<pre><code>'use strict';
function documentIsReady() {
// All document items are available...
    console.log("documentIsReady");
    new Main(); // Call Main() function
}


var Main = function(){
    console.log('entered- Main');

    var input = document.getElementById('input');
    input.addEventListener('change', handleFiles, false);

    function handleFiles(e) {
        console.log('entered- cameraListener');

        var url = URL.createObjectURL(e.target.files[0]);
        var img = new Image();
        //img.id = 'img';
        img.src = url;

        img.onload = function () {
            console.log('entered- OnLoadImage');

            img=changeImgSize(img); // &lt;-- HERE IS THE ERROR

        };
    }
};
</code></pre>

<p>I tried to change the order of the call of my files there is still the error. I tested it on chrome and it works fine</p>