DEV Community

How else you can define properties for JavaScript objects

Cristian Curteanu on November 24, 2018

JavaScript is an awesome technology. It's really flexible, and allows cool runtime object manipulation, which are not such a headache like in case ...
Collapse
 
dekadentno profile image
Matej

Thanks for the post, I've found it very useful.
Found a little mistake in your code. In your initialization, you have:

...
engine: {
        stage: 'off'
    }
...

But everywhere else, you've used (e.g.):

this.engine.state = 'on'

Collapse
 
cristicurteanu profile image
Cristian Curteanu

Hey Matej!

I have noticed it, thanks for pointing out! I have added the proper changes, and now it should be fine!

Cheers!

Collapse
 
ryanmaffey profile image
Ryan Maffey

I had no idea you could do so much with Object.defineProperty! Really useful info - thanks for the post :)