Sunday 15 July 2012

javascript - How to call a function using Object's Key..? -


From my object iteration, I am trying to call the function and trying to send the data as a parameter I am trying to get my error,

My attempt:

  var x = function ()  

Msg) {console.log (Msg); } Var y = function (msg) {console.log (msg); } Var obj = {x: "i am x", y: "i am y"} var all = function () {$ .each (function, (key, value) {[key] (value);}) } All();

The right approach to any one person is here.

< P> Try this way
  var funcs = {x: function (msg) {console.log (msg); }, Y: function (msg) {console.log (msg); }}; Var obj = {x: "i am x", y: "i am y"} var all = function () {$ .each (function, (key, value) {funcs [key] (value);}) } All();   

This is your Bela

No comments:

Post a Comment