Vote count: 0 im creating a class where i would be able to have in my constructor dynamic variables, but im not sure if im doing the right way or if it is valid. Example static: my class: class MyClass{ constructor(options){ this.propertyname = options.value; this.propertyname = options.value; this.propertyname = options.value; } } Does this example would be the same of the above? My only issue would be that the example i have wasnt making the options value assign to "this." my class: class MyClass{ constructor(options){ for (var property in options) { if (options.hasOwnProperty(property)) { this[property] = options[property]; } } } } Calling: var example = new MyClass({ property1: "Somethin...
ادامه مطلبVote count: 0 Working on an ASP.NET website. I have a page where there are alot of dynamically created textboxes. In addition to these textboxes I link dynamic javascript calculations to certain textboxes as well. This is all database driven. For example.... (pseudo-code) textbox1 = "10" textbox2 = "4" textbox3 = textbox 1 + textbox 2 (displays "14") All of the textboxes are working great, dynamically calculating correctly, etc.... BUT, I need to format them with commas, if applicable. All of these dynamic textboxes have a css class of 'dynamic_control'. Question: I would like to autoformat numbers > 999 with commas. (AFTER any calculations are finalized.) So, what I did was this... $(docume...
ادامه مطلبVote count: 0 How could I call the class function from its string? After I check if the function exists if(typeof requestName == 'function') { } I need to call the class function, for example CreateJob inside class Foo. How could I do this? var Foo = function(credentialsObject){ this.cred = credentialsObject; }; Foo.prototype.SendRequest = function(requestName,dataObj) { // If create requestName, job object exists and credentials have been setup, proceed with a requestName call if(requestName && dataObj && (this.cred.userID && this.cred.apiKey)) { // Check if the function exists if(typeof requestName == 'function') { } } }; Foo.prototype.CreateJob = function(dataObj) { }; Foo.prototype.Cance...
ادامه مطلب