Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7676977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:19:15+00:00 2026-05-31T17:19:15+00:00

I have the following javascript method: function 123_test_function(){ } The function is generated by

  • 0

I have the following javascript method:

function 123_test_function(){

}

The function is generated by java and sent to the client. The 123 is the id of the component so it could change. i.e I can have another function called 111_test_function()
I want to pass this function as a reference.

So I need to create the reference

var 123_test_function = function 123_test_function(){

}

In another js file inside an object I have a function that needs to use the 123_test_function reference like so:

useFunction(123_test_function);

The problem I’m having is which the 123 part of the function.
In this object I have a variable(uniqueID) which has the number at the beginning of the function.
I need the function call to be something like:

useFunction(uniqueID+"_test_function");

This doesn’t seem to pass a function instead it passes a string.
Am I doing something wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:19:16+00:00Added an answer on May 31, 2026 at 5:19 pm

    For one, identifiers (such as function names) cannot begin with a digit.

    To solve your problem, use an object, like this:

    // 1. define an object to hold all your functions
    var allFunctions = {};
    
    // 2. store any function with a unique string as the ID
    allFunctions['123_test_function'] = function () {
      // whatever
    };
    
    // 3. call the function
    allFunctions['123_test_function']();
    allFunctions[uniqueID + '_test_function']();
    

    Objects are associative arrays. They store key/values pairs, so they do exactly what you want here.

    Note that functions don’t need a name in JavaScript, so I did not use on in step 2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following javascript function: <script type=text/javascript> function quickCardRegister_OnCompleteSave() { publishContent('This is a
I have the following Javascript code add_num = { f: function(html, num) { alert(this.page);
I have the following JavaScript code: var cILo=true; var img1=images/title-2a.png; var img2=images/title-2b.png; function loadblinker()
I have the following javascript function that fails a jslint check function hasActiveX() {
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; if(form.fName.value ==
I have written the following in a JavaScript method : <html> ... <script type=text/javascript
So I have the following Jquery calling a Javascript method $j(a.Pinterest).attr(href, javascript:void(addScript());); And this
I have the following Javascript function that should return an array of groups that
i have the following javascript file named coupon.js - jQuery(document).ready(function(){ jQuery('.appnitro').submit( function() { $.ajax({
I have the following javascript: <script type=text/javascript> function showjQueryDialog() { $(#dialog).dialog(open); } $(document).ready(function() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.