Reference versus Value
Another unique property of server-side code, is the structure of a GlideRecord. A GlideRecord consists of field-value pairs; the name of the GlideRecord object property corresponds to the field name (i.e. gr.number refers to the number field of the corresponding record). However, on the client, these properties of the GlideRecord object are strings; whereas on the server, these properties refer to GlideElement objects.
Why is this important, you ask? To answer that question, we must first understand one of the quirks of JavaScript: Pass-by-reference. In JavaScript, a variable can hold one of two types of values: a primitive value, or a reference. A primitive value might be a string, a number, a boolean (or null or undefined). ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access