You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// regular function - 'this' refers to parent, left of the dot
3
-
// arrow function - 'this' refers to it's current surrounding scope
1
+
// default parameters - a fallback to a value to prevent incase functionality breaks if the parameter is not passed i.e undefined. The argument/parameter passed will have more precedence than the default parameter
4
2
5
-
constbtn=document.querySelector(".btn");
3
+
// arrow function gotchas - hositing doesn't work since it has variable name to defined
6
4
7
-
btn.addEventListener("click",function(){
8
-
console.log(this);
5
+
sayHi();
9
6
10
-
// Here, it points to window, since window is parent of setTimeOut
0 commit comments