Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140101

Bind additional properties at instantiation

$
0
0

Let's say I have a class.

class Room {
    constructor() {
        this.width = 100
        this.height = 200 
    }
}

I would like to bind additional properties to it at instantiation.

new Room.bind({ capacity: 5 })()

Is this possible? (without doing it through arguments)


Viewing all articles
Browse latest Browse all 140101

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>