Skip to content

Commit 9b56574

Browse files
committed
Coded principle 3 int this.js
1 parent 1ea6c12 commit 9b56574

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎this.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ function logWindow() {
1919
// Principle 2: code example for Implicit Binding
2020
const bob = {
2121
name: 'Bob',
22-
22+
2323
sayName() {
2424
console.log(this.name);
2525
}
2626
}
2727

2828
// Principle 3: code example for New Binding
29+
function Person(name) {
30+
this.name = name;
31+
}
32+
33+
const bobette = new Person('Bobette');
2934

3035
// Principle 4: code example for Explicit Binding
36+

0 commit comments

Comments
 (0)