Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/* The four rules for 'this';
* in your own words. explain the four rules for the "this" keyword below.
* 1.
* 2.
* 3.
* 4.
* 1. When you have 'this' inside a function in a global scope; its value will be the window object
* 2. On functions called by a preceding dot; the object before the dot is 'this'
* 3. 'this' points to an instance of an object when uusing a constructor function
* 4. 'this' can be explicitly defined when using the call or apply method
* write out a code example of each explanation above
*/

// First Rule

function greet(name) {
console.log(`Hello ${name}`);
console.log(, this);
}
console.log(, this);
conosle.log('greet', greet('Allan'));
// Second Rule

// Third Rule
Expand Down