Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Is Prototype.js still needed with ES2021 or can I simply define a class?

Tobias Persson_
Tera Expert

Hey community!

 

I was wondering if I still need to use the old Script Include pattern for class creation. This is currently inserted by the ServiceNow instance when I create a new Script Include:

var MyScriptInclude = Class.create();
MyScriptInclude.prototype = {
initialize: function() {
},

type: 'MyScriptInclude'
};

 

Now, I would like to know if I can replace this with the following code and still expect it to work as it should when my scoped application is set to ECMA2021:

class MyScriptInclude {
contructor() {

}

myOwnMethod() {

}
}


Tobias

0 REPLIES 0