1

I've defined the following JS constructor function

function FV.Map(element) {
  // impl omitted
}

The function definition causes the following error to appear in Firebug

missing ( before formal parameters

The FV is a global object that I use as a namespace for all my functions. Apparently this is not the right way to add this function to this namespace, what should I use instead?

2 Answers 2

3
window.FV = window.FV || {}
FV.Map = function(element) {
    //…
}
Sign up to request clarification or add additional context in comments.

Comments

0

A more intuitive syntax would perhaps be this...

window.FV = {
    Map: function(element){
       Do Something
    },
    Morefuncs: function(element, element2){
       Do something else
    }
};

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.