We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

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