Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JavaScript functions with the same name

Posted on 2015-02-19
1
Medium Priority
?
68 Views
Last Modified: 2015-02-20
How do you call a JavaScript function that is defined  in more than one library?
Is there a namespace associated with the function?
0
Comment
Question by:metro156
1 Comment
 
LVL 22

Accepted Solution

by:
ambience earned 2000 total points
ID: 40620766
You cant, there can only be one function with a name. However, you can do  something like


<script src="script1.js" />
<script>

    var module1 =  {
          func = SomeFuncWithName;
    };
</script>
<script src="script2.js" />
<script>

    var module2=  {
          func = SomeFuncWithName;
    };

    // call first func
    module1.func();

    // call second
    module2.func();
</script>

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Suggested Courses

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question