When are you supposed to use this.getField vs. getField and why?
I'm brand new.
When I'm looking at this forum sometimes I see this.getField("fieldname").xxx and sometimes I see getField("fieldname").xxx
When are you supposed to use which and why?
I'm brand new.
When I'm looking at this forum sometimes I see this.getField("fieldname").xxx and sometimes I see getField("fieldname").xxx
When are you supposed to use which and why?
I see a lot more problems when "this" is used when not appropriate compared to omitting it when not appropriate. The former can lead to subtle bugs and the latter normally causes an immediately apparent error, which you then fix. I almost always omit it in most code that resides in a document, but almost never do in folder-level JavaScripts. I've never had a problem doing so in almost 20 years, and I've saved 5 bytes in every instance. I find the code much more readable when omitted, so for the most part it comes down to a matter of programming style.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.