newbie
newbie

Reputation: 14950

AMD Module Javascript: Module Loader Error

I have created this module:

define(function(){

    function isEmpty(stValue)
    {
        return false;
    }

    function inArray(stValue, arr)
    {
        return false;
    }

    return 
    {
        isEmpty : isEmpty,
        inArray : inArray   //Error here
    };
});

But I'm having an error: Module Loader Error on line inArray : inArray. Is my module correct?

Upvotes: 1

Views: 44

Answers (1)

Daniel A. White
Daniel A. White

Reputation: 190907

You are getting automatic semicolon insertions. You are effectively returning undefined.

define(function(){

    function isEmpty(stValue)
    {
        return false;
    }

    function inArray(stValue, arr)
    {
        return false;
    }

    return { // correct here
        isEmpty : isEmpty,
        inArray : inArray   //Error here
    };
});

Upvotes: 2

Related Questions