File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,17 +8,20 @@ class Timer {
88 this . pauseButton = pauseButton
99
1010 // start(){}, Calling the constructor anytime the user clicks on the start button
11- this . startButton , addEventListener ( 'click' , this . start )
11+ this . startButton . addEventListener ( 'click' , this . start )
1212 }
1313
1414 start ( ) {
15- console . log ( 'Time to start the timer!' ) ;
15+ // console.log('Time to start the timer!');
16+ console . log ( this ) ;
1617 }
1718}
1819
1920const durationInput = document . querySelector ( '#duration' )
20- const startButton = document . querySelector ( '#pause ' )
21+ const startButton = document . querySelector ( '#start ' )
2122const pauseButton = document . querySelector ( '#pause' )
2223
2324// Create our instance of the timer and pass in those three elements
2425const timer = new Timer ( durationInput , startButton , pauseButton )
26+
27+ timer . start ( )
Original file line number Diff line number Diff line change 22
33## 1. 06 Binding Events in a Class
44
5- ##
5+ ## 2. 08 Determining the Value of 'This'
6+
7+ #### Determining the value of this inside of an arrow function
8+
9+ ``` javascript
10+ const colors = {
11+ printColor () {
12+ console .log (this )
13+ },
14+ }
15+
16+ colors .print ()
17+ ```
18+
19+ ``` javascript
20+ const colors = {
21+ printColor () {
22+ console .log (this )
23+ const printThis = () => {
24+ console .log (this )
25+ }
26+ printThis ()
27+ },
28+ }
29+
30+ colors .print ()
31+ ```
32+
33+ #### Calling the function with bind, call or apply
34+
35+ ** bind, call and apply** are built-in functions that belong to all functions inside of JavaScript that we create
You can’t perform that action at this time.
0 commit comments