learn this, but not very clear

This commit is contained in:
2024-06-02 15:32:46 +02:00
parent e9d6b3ad15
commit 1e55406e8f
3 changed files with 55 additions and 0 deletions

16
4.4this/t2.js Normal file
View File

@@ -0,0 +1,16 @@
let ladder = {
step: 0,
up() {
this.step++;
return this;
},
down() {
this.step--;
return this;
},
showStep: function() { // shows the current step
alert( this.step );
return this;
}
};
ladder.up().up().down().showStep().down().showStep(); // shows 1 then 0