Whats wrong with this constructor? Am i allowed to...
# suitescript
s
Whats wrong with this constructor? Am i allowed to do this? NS seems to like it when i dont make a contructor there... define(['N/currentRecord', 'N/log', 'N/ui/dialog'], function (record, log, dialog) { function Sublist(lines, quantities = [], names = []) { this.lines = lines; this.quantities = quantities; this.names = names; } // var initialSublist = new Sublist(); function beforeLoad(context) { }//end of beforeLoad return { beforeLoad: beforeLoad, } });//end of everything
i get a
missing ) after formal parameters
but i dont see where its talking about
a
I'm not sure if it matters but it might be the extra comma at the end
beforeLoad: beforeLoad,
s
nah that wasnt it. When i comment out the constructor i get no errors
Im pretty new to js. Is that even common practice to create a constructor after the
define(['N/currentRecord', 'N/log', 'N/ui/dialog'], function (record, log, dialog)
?
a
constructors are usually for classes
e
I don't think SS2.0 supports default params. Change it to SS2.1 or use
this.quantities = quantities || [];
instead
👍 1
s
oof i think that was it
thanks @ehcanadian. Hail from BC 🙂