How to insert function value into js object. I try this construction (code with jQuery).
foo = $('.bar'); obj = { 0: function(){ if (foo[0].id){ return foo[0].id //Если у элемента есть id, то его надо вернуть } } } At the exit I get
Object {0: function()} And it is necessary that the element id be in the property. How can this be done, please tell me.