title: Javascript dynamically attaching functions to objects
body: <p>How to attach a function dynamically to a javascript object.For ex: if the function for dynamic attachment is attach(),then i should be able to attach the function fn to onject obj as follows..</p>
  
  <pre><code>attach(
       obj,fn,{
                    alert(1)
              }
        )
  
  
  function attach(obj,fnName,code)
  {
      obj[fnName] = code;
  }
  </code></pre>