Prob due to the NetSuite docs always having this a...
# suitescript
k
Prob due to the NetSuite docs always having this at the top.
e
Hmm do they? I've never noticed, but yes that would provide one strong possibility
k
Yeah all the time I looked at examples they always had these at the top.
e
I totally understand an alias if you have a really deep reference like
level1.anotherLevel.yetanotherlevel.somecrazynesting.omgsrsly.thePropertyYouActuallyWant
k
Yeah I've gotta brush up on my chaining but keeping them separate does look tidy sometimes.
e
but I don't understand aliasing
context.line
to
line
but I see it quite often from a lot of people
k
I had to split things out in a MR once while using underscore as when chained it just wouldn't work due to the processing time and the amount of data it was processing.
I do get the line one though.
b
Exactly as @karlenigma said, its part of the documentation, though I'm sure with more experience I'll recognize when it's needed or not
j
I often alias
var rec = context.currentRecord;
or
var rec = context.newRecord;
to abbreviate my code, but generally only if I have a lot of references to the record object. If I only reference the object once it's not as useful to alias it.