0

I'm getting this error for having to immediately invoked closures on the same page.... But if I only have one Immediately invoked the functions executes fine.. Wondering why this is the case.

Error:

Uncaught TypeError: (intermediate value)(intermediate value)(...) is not a function at (index):57

<script>
(function(){
    var checkCharacater = function(word){
        for (var i = 0; i < word.length; i++) {
            var count = 0;
            for (var k = 0; k < word.length; k++) {
                if(word[i] == word[k]){
                    count++;
                }
            }
            if(count == 1){
                return word[i];
            }  
        };
    }
    console.log(checkCharacater(teeter));
})()


//Design a progress bar that completes 100% in 5 seconds

(function(){
    var doc = document;
    var progressBar = doc.getElementById('progressBar');

    var doProgress = function(){
        progressBar.value++

        var intervalId = setTimeout(function(){
            doProgress()
        }, 50);
    }

    doProgress();
})()

Uwe
  • 41,420
  • 11
  • 90
  • 134
Seena Khoee
  • 29
  • 1
  • 8

0 Answers0