🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 101 (from laksa186)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

📄
INDEXABLE
CRAWLED
8 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.3 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://lage.us/Javascript-Variable-Name-Function-Call.html
Last Crawled2026-04-08 04:23:30 (8 days ago)
First Indexed2020-07-18 18:44:29 (5 years ago)
HTTP Status Code200
Meta TitleVariable Name Functions
Meta DescriptionCall a function using a variable. A variable with the the value of a function name can call the function using this method.
Meta Canonicalnull
Boilerpipe Text
Call a function using a variable. A variable with the value of a function name can call the function using this method. Method 1 - standard functions /* fcn - function name arg - argument(s) if any */ function run(fcn, arg) { return window[fcn](arg); // can also be: return top[fcn](arg); // can also be: return this[fcn](arg); } Example 1: function callFunctionByVariable(msg) { return msg; } variableFunctionName = "callFunctionByVariable"; console.log(run(variableFunctionName, "hi")); // console prints hi Method 2 - prototype functions // call: String.run(); String.prototype.run = function() { return window[this](); } Example 2: Javascript (call these functions using variables) For example purposes, there are a list of functions which return one word. Each function is called using variable values contained in an array corresponding to the function name. This demonstrates that a function call can be made from a variable. Using the prototype function (Method 2), each of these functions will be called using variable values. // list of functions to be called function a() { return "This "; } function b() { return "sentence "; } function c() { return "is "; } function d() { return "created "; } function e() { return "by "; } function f() { return "a "; } function g() { return "list "; } function h() { return "of "; } function i() { return "function "; } function j() { return "variable "; } function k() { return "names"; } function l() { return "."; } // array of String values to be used to call the functions by the same name functionList = ["a","b","c","d","e","f","g","h","i","j","k","l"]; // loop through the array and call the functions // using the array String variable values for (x=0; x<functionlist.length; x++) { document.getElementById("sentence").innerHTML += functionList[x].run(); } HTML (put the result here) <div id="sentence"></div>
Markdown
[Lage.us](https://lage.us/) [PHP Snippets](https://lage.us/php.html) \| [HTML Snippets](https://lage.us/html.html) \| [Javascript Snippets](https://lage.us/javascript.html) \| [CSS Snippets](https://lage.us/css.html) # Variable Name Functions Call a function using a variable. A variable with the value of a function name can call the function using this method. ### **Method 1 - standard functions** ``` /* fcn - function name arg - argument(s) if any */ function run(fcn, arg) { return window[fcn](arg); // can also be: return top[fcn](arg); // can also be: return this[fcn](arg); } ``` ### Example 1: ``` function callFunctionByVariable(msg) { return msg; } ``` ``` variableFunctionName = "callFunctionByVariable"; console.log(run(variableFunctionName, "hi")); // console prints hi ``` *** ### **Method 2 - prototype functions** ``` // call: String.run(); String.prototype.run = function() { return window[this](); } ``` ### Example 2: **Javascript** (call these functions using variables) For example purposes, there are a list of functions which return one word. Each function is called using variable values contained in an array corresponding to the function name. This demonstrates that a function call can be made from a variable. Using the prototype function (Method 2), each of these functions will be called using variable values. ``` // list of functions to be called function a() { return "This "; } function b() { return "sentence "; } function c() { return "is "; } function d() { return "created "; } function e() { return "by "; } function f() { return "a "; } function g() { return "list "; } function h() { return "of "; } function i() { return "function "; } function j() { return "variable "; } function k() { return "names"; } function l() { return "."; } // array of String values to be used to call the functions by the same name functionList = ["a","b","c","d","e","f","g","h","i","j","k","l"]; // loop through the array and call the functions // using the array String variable values for (x=0; x<functionlist.length; x++) { document.getElementById("sentence").innerHTML += functionList[x].run(); } HTML (put the result here) <div id="sentence"></div> ``` Copyright © Lage.us Website Development \| [Disclaimer](https://lage.us/disclaimer.html) \| [Privacy Policy](https://lage.us/privacy-policy.html) \| [Terms of Use](https://lage.us/terms-of-use.html) #### Main Menu [PHP Snippets](https://lage.us/php.html) [HTML Snippets](https://lage.us/html.html) [Javascript Snippets](https://lage.us/javascript.html) [CSS Snippets](https://lage.us/css.html) #### Javascript Snippets [Change a Page's Stylesheet Using Javascript](https://lage.us/Javascript-Change-Page-Stylesheet.html) [Javascript If-Else Shortcut Ternary Operator](https://lage.us/Javascript-If-Else-Shortcut-Ternary-Operator.html) [Swap Variables in One Line of Code](https://lage.us/Javascript-swap-variables-in-one-line.html) [Javascript array\_unique (similar to PHP)](https://lage.us/Javascript-array_unique.html) [Sort a Javascript 2d Array by Any Column Value](https://lage.us/Javascript-Sort-2d-Array-by-Column.html) [Sort an HTML Table by Column Using Javascript](https://lage.us/Javascript-Sort-HTML-Table-by-Column.html) [Variable Name Functions](https://lage.us/Javascript-Variable-Name-Function-Call.html) [Accordion Menu](https://lage.us/Javascript-Accordion-Menu.html) [Replace All function using Javascript](https://lage.us/Javascript-replaceAll\(\).html) [Occurrences of Substring in String](https://lage.us/Javascript-substr-count.html) [Detect Javascript Swipe for Touch Screens and Mouse](https://lage.us/Javascript-Detect-Swipe-for-Touch-and-Mouse.html) [Get Hypotenuse Using Pythagorean](https://lage.us/Javascript-Pythagorean-Get-Hypotenuse.html) [Create an Image Zoom Window with Javascript](https://lage.us/Javascript-Image-Zoom-Window-with-Javascript.html) [Get String Between Strings with Javascript](https://lage.us/Javascript-Get-String-Between-Strings.html) [Immediately Invoke a Javascript Function](https://lage.us/Javascript-Immediately-Invoke-Function.html) [Check if String Contains Substring](https://lage.us/Javascript-String-Contains-Substring.html) [Round Numbers Accurately to Specified Place Value with Javascript](https://lage.us/Javascript-Round-Numbers-to-Specified-Place-Value.html) [Check if String Contains Substring](https://lage.us/Javascript-String-Contains-Substring.html) [Pass Javascript Variables to Another Page](https://lage.us/Javascript-Pass-Variables-to-Another-Page.html) [Split a String Into a 2-Dimensional-Array](https://lage.us/Javascript-Split-String-Into-2-d-Array.html) [Strip HTML Tags from String](https://lage.us/Javascript-Strip-HTML-Tags.html) [Remove Quotes from String](https://lage.us/Javascript-Remove-Quotes-From-String.html) [Remove Return Characters From String](https://lage.us/Javascript-Remove-Return-Characters-From-String.html) [Determine if a Javascript Variable is a Number](https://lage.us/Javascript-Determine-If-Variable-Is-Number.html) [Copy text from an input box to the clipboard](https://lage.us/Javascript-Copy-To-Clipboard.html) [Fade an Element In or Out with a Toggle](https://lage.us/Javascript-Fade-In-Or-Out-An-Elelemt.html) [Javascript Equivalent to file\_get\_contents("filename.html")](https://lage.us/Javascript-File-Get-Contents.html) [Random Shuffle Javascript Array](https://lage.us/Javascript-Random-Shuffle-Array.html) [Determine When HTML Element Comes Into Viewport While Scrolling](https://lage.us/Javascript-Determine-When-Element-Is-In-View.html) [Conditionally Load a Javascript File](https://lage.us/Javascript-Conditionally-Load-JS-File.html) [Javascript Send Form With No Target](https://lage.us/Javascript-Send-Form-With-No-Target.html) [Check for Mobile Phone](https://lage.us/Javascript-Mobile-Phone-Check.html) [Get the Date String in Milliseconds](https://lage.us/Javascript-Get_Date.html) [Javascript Equivalent to array\_unique()](https://lage.us/Javascript-array_unique.html) [Javascript Equivalent to the PHP natsort()](https://lage.us/Javascript-Equivalent-to-natsort.html) [Watch or Monitor Javascript Variables for Change](https://lage.us/Javascript-Watch-Variables-for-Change.html) [Javascript Equivalent to the PHP array\_values function](https://lage.us/Javascript-Array_Values.html) [Find if Item Exists in 2-Dimentional Javascript Array](https://lage.us/Javascript-Item-in-2d-Array-Using-indexOf.html) #### My sites [indoorclimbing.com](https://www.indoorclimbing.com/) [ziplinerider.com](https://www.ziplinerider.com/)
Readable Markdown
Call a function using a variable. A variable with the value of a function name can call the function using this method. ### **Method 1 - standard functions** ``` /* fcn - function name arg - argument(s) if any */ function run(fcn, arg) { return window[fcn](arg); // can also be: return top[fcn](arg); // can also be: return this[fcn](arg); } ``` ### Example 1: ``` function callFunctionByVariable(msg) { return msg; } ``` ``` variableFunctionName = "callFunctionByVariable"; console.log(run(variableFunctionName, "hi")); // console prints hi ``` *** ### **Method 2 - prototype functions** ``` // call: String.run(); String.prototype.run = function() { return window[this](); } ``` ### Example 2: **Javascript** (call these functions using variables) For example purposes, there are a list of functions which return one word. Each function is called using variable values contained in an array corresponding to the function name. This demonstrates that a function call can be made from a variable. Using the prototype function (Method 2), each of these functions will be called using variable values. ``` // list of functions to be called function a() { return "This "; } function b() { return "sentence "; } function c() { return "is "; } function d() { return "created "; } function e() { return "by "; } function f() { return "a "; } function g() { return "list "; } function h() { return "of "; } function i() { return "function "; } function j() { return "variable "; } function k() { return "names"; } function l() { return "."; } // array of String values to be used to call the functions by the same name functionList = ["a","b","c","d","e","f","g","h","i","j","k","l"]; // loop through the array and call the functions // using the array String variable values for (x=0; x<functionlist.length; x++) { document.getElementById("sentence").innerHTML += functionList[x].run(); } HTML (put the result here) <div id="sentence"></div> ```
Shard101 (laksa)
Root Hash5460030241653794101
Unparsed URLus,lage!/Javascript-Variable-Name-Function-Call.html s443