class DynamicProperties {
constructor(keys, values) {
keys.forEach((key, i) => {
this[ key ] = values[ i ];
})
}
}
class Particle extends DynamicProperties {
static primary_keys = ['a', 'b', 'c', 'd'];
constructor(x, y) {
super(Particle.primary_keys, [ x, y, x*2, 3 ]);
}
}
const my_test_particle = new Particle(1, 2);
// Particle {a: 1, b: 2, c: 2, d: 3}