Dictionary Functions

How To Run Functions Referenced In A Javascript Dictionary

First we'll initialise a simple object/dictionary with some 2 key/value pairs.

var dict = {
  text: 'Hello',
  action: 'fun'

Now on the the actual fun function. We'll declare it as a variable.

var fun = function(text) {

Pull the key/value pairs from the dictionary and store them as variables.

var text = dict.text;
var action = dict.action;

Release the hounds.


Thanks for reading. x


  • A keyboard