# Reference function with a variable

**URL:** https://forum.kirupa.com/t/reference-function-with-a-variable/305733
**Category:** Uncategorized
**Created:** [March 2, 2010, 8:56pm UTC](https://forum.kirupa.com/t/reference-function-with-a-variable/305733 "2010-03-02T20:56:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![activa](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@activa](https://forum.kirupa.com/u/activa)
#### Post date: [March 2, 2010, 8:56pm UTC](https://forum.kirupa.com/t/reference-function-with-a-variable/305733/1 "2010-03-02T20:56:12Z")

</div>

Is there a way to reference a function via a variable? In other words, instead of saying something like:

var theVar = someString + ‘function’;  
if (theVar == ‘functionName’) functionName ();

to access it directly:  
(someString + ‘function’) ();

using some kind of bracket notation?
