This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alert(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function printHP() { | |
console.log(this); | |
} | |
var car = { | |
year: '2010', | |
make: 'Honda', | |
color: 'White', | |
transmission: 'Manual', | |
horsePower: 140, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printThis = () => { | |
console.log(this); | |
} | |
var car = { | |
year: 2015, | |
printThis: printThis | |
} | |
printThis(); // will print the global/window object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function printCar() { | |
console.log(this) | |
} | |
var car = { | |
speed: 240 | |
} | |
printCar = printCar.bind(car) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(Object.getOwnPropertyDescriptors(car)); | |
// Output | |
/*{ year: | |
{ value: '2010', | |
writable: true, | |
enumerable: true, | |
configurable: true }, | |
make: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var car = Object.create(Object.prototype, { | |
year: { | |
value: '2010', | |
writable: true, | |
enumerable: true, | |
configurable: true }, | |
make: { | |
value: 'Honda', | |
writable: true, | |
enumerable: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var car = { | |
year: '2010', | |
make: 'Honda', | |
color: 'White', | |
transmission: 'Manual', | |
horsePower: 140, | |
topSpeed: 120 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var horsePower = 50; | |
function printHP() { | |
console.log(this.horsePower); | |
} | |
var car = { | |
year: '2010', | |
make: 'Honda', | |
color: 'White', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
int i = 123; | |
float f = 98.6; | |
double d = 6.022E23; | |
char c = 'c'; | |
int* iPtr = &i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
int val = 123; | |
int* valPtr = &val; | |
printf("address of &val = %p\n", &val); | |
printf("value of val = %d\n", val); | |
printf("value of valPtr = %p\n", valPtr); |
NewerOlder