Learn JavaScript on the Now Platform: Lesson 33 - Classes

preview_player
Показать описание
In lesson 33 learn how to improve testing and reduce mainteance by creating object templates known as classes. Go beyond properties and add functions to your objects!

Рекомендации по теме
Комментарии
Автор

Hi Chuck. Great videos!

I was wondering if you could clear up something.

In LS33S01 you made a modification to type: 'person'. You got rid of the quotes around person. Yet in LS33S02 you made no mention of this even though the quotes were again around person. Code ran fine either way. Does it actually matter?

marcpaquette
Автор

Hey Chuck. I'm a little confused and hoping you can explain.

I followed your script to the letter and while it works within Scripts - Background, it does not work in VScode nor when running `node c:\path\to\file.js`. It returns "ReferenceError: Class is not defined", pointing at `var Person = Class.create()`

I looked up Class.create() on MDN, but their documentation states to use a constructor to build a class. Can you explain what's going on here? I'm assuming it's some sort of legacy (or otherwise old) JS engine within ServiceNow and Class.create() is no longer accepted in today's JavaScript environment.

Great series, I plan on finishing it very soon.

dylanhutchens
Автор

Just in case someone wants to check out script includes:

PracticeSNow
welcome to shbcf.ru