Skip to content

Latest commit

 

History

History
21 lines (19 loc) · 390 Bytes

shang_2this.md

File metadata and controls

21 lines (19 loc) · 390 Bytes
function identify() {
    return this.name.toUpperCase();
}
function speak() {
    var greeting = "Hello, I'm " + identify.call( this ); 
    console.log( greeting );
}
var me = {
    name: "Kyle"
};
var you = {
    name: "Reader"
};
identify.call( me ); // KYLE
identify.call( you ); // READER
speak.call( me ); // Hello, 我是 KYLE 
speak.call( you ); // Hello, 我是 READER