-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththis.js
52 lines (46 loc) · 1.05 KB
/
this.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* var car = {
made: 'BMW',
model: 'V154NB',
owner: 'izikzo',
price: function(carPrice) {
// console.log('The price: '+ carPrice);
return carPrice;
},
description: function() {
console.log('This '+ this.made +' with Model: '+ this.model + ' Costs $'+ this.price(7000));
}
}
car.description(); */
/*
function first() {
return this;
}
console.log(first() === global);
*/
/* function second() {
'use strict';
return this;
}
console.log(second() === global);
*/
/*
let myObject = {
value: 'MyObject'
};
console.log(myObject.value);
// Value is set on the global object
globalThis.value = 'Global Object';
function third() {
return this.value;
}
console.log(third());
console.log(third.call(myObject)); */
function myNames(firstName,lastName) {
console.log(this.firstName +' '+ this.lastName);
}
let name1 = {
firstName: 'Ndahimana',
lastName: 'Bonheur',
printNames: myNames(this.firstName,this.lastName)
};
name1.printNames;