This Gist was automatically created by Carbide, a free online programming environment.
Created
January 26, 2021 02:07
-
-
Save carbide-public/dc7f448535d1367a779829050cf99f97 to your computer and use it in GitHub Desktop.
untitled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass { | |
a = 1; | |
b = 2; | |
constructor(overwrite){ | |
Object.assign(this, overwrite); | |
console.log(this) | |
} | |
} | |
const test1 = new MyClass() ///a = 1; b = 2 | |
const test2 = new MyClass({a: 2, b : 5}) ///a = 2; b =5; | |
const test3 = new MyClass({a: 900, b: 1000}); ///a = 900; b = 1000; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment