Skip to content
Advertisement

Set undefined javascript property before read

JavaScript

Is there any way to make tr.Other or tr[‘Other’] and all other undefined properties of the object to return its name instead undefined?

Advertisement

Answer

You could define a getter for your property, either using object initializers:

JavaScript

or using Object.defineProperties():

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement