[Solved] How can I optimize my javascript object? [closed]


function field($sel){

     //field odject
     var $field = $($sel);
     var offset = $field.offset();
     var field = {
         width: $field.width(),
         offsetTop:offset.top,
         offsetLeft: offset.left,
         offsetRight: offset.left + $field.width(),
         offsetBottom: offset.top + $field.height()
     };

     return field;

}

You extend your functionality by creating a constructor and return the object from your function.

3

solved How can I optimize my javascript object? [closed]