I wanted to extend the Paragraph
(type? class? object?) and add some repeating functions to it like:
Paragraph.prototype.isEmpty = function() {
return this.getText().trim().length === 0;
};
ReferenceError: "Paragraph" is not defined. (line 23, file "Code")
or
DocumentApp.Paragraph.prototype.isEmpty = function() {
return this.getText().trim().length === 0;
};
TypeError: Cannot read property "prototype" from undefined. (line 23, file "Code")
but none of these work. I put this code in a Code.gs
file and tried to use it but the compiler says there is no such thing.
What is this thing actually and how can I add something to it?