javascript - What is the difference between `this` and `var` in a function. -
this question has answer here:
i have following javascript code project @ school. (this code provided me.) can explain difference between var setdatarequest
, this.setdatarequest
understand happening in functions, not why functions created in fashion. similar overloading?
tele.forms.controller = new function () { var _requestdata; this.setrequestdata = function (requestdata) { _requestdata = requestdata; }; var setrequestdata = function () { var fields = $('.formsmaintable'); var reqdata = ['request_record_id', 'date_submitted', 'requester_id']; .... .... }; .... .... };
this.setrequestdata
available @ tele.forms.controller.setrequestdata
, while var setrequestdata
available internals of function. think of this.setrequestdata
api of tele.forms.controller
object, , setrequestdata
1 of internal methods allows api work (i'm making assumption ...
makes connections between this.setrequestdata
, setrequestdata
).
Comments
Post a Comment