Michael Theriot (2016-03-18T15:10:27.000Z)
michael.lee.theriot at gmail.com (2016-03-18T15:59:04.854Z)
Try this... It will only seal if calling new (the constructor syntax only allows you to call new as well). The subclasses will still need to seal though. ```js 'use strict'; class Test { constructor() { this.x = 1; if(new.target === Test) { Object.seal(this); } } } class SubTest extends Test { constructor() { super(); this.y = 2; if(new.target === SubTest) { Object.seal(this); } } } var st = new SubTest(); st.x; // 1 st.y; // 2 st.z = 3; // throws error ```
michael.lee.theriot at gmail.com (2016-03-18T15:46:11.474Z)
Try this... It will only seal if calling new. The subclasses will still need to seal though. ```js 'use strict'; class Test { constructor() { this.x = 1; if(new.target === Test) { Object.seal(this); } } } class SubTest extends Test { constructor() { super(); this.y = 2; if(new.target === SubTest) { Object.seal(this); } } } var st = new SubTest(); st.x; // 1 st.y; // 2 st.z = 3; // throws error ```