x + y; } // 2 let i: number = 0; function sum2(x: number, y: number): number { i += x + y; return x + y; } // 3 function sum3(x: number, y: number): number { return x + y + i; } // 4 function sum4(x: number, y: number): number { const result = x + y; console.log(result); return result; }
x + y; } // 2 let i: number = 0; function sum2(x: number, y: number): number { i += x + y; return x + y; } // 3 function sum3(x: number, y: number): number { return x + y + i; } // 4 function sum4(x: number, y: number): number { const result = x + y; console.log(result); return result; } Ұ͚͕ͭͩ७ਮͳؔͰ͢ ଞશͯʰෆ७ʱͳؔͰ͢
x + y; } // 2 let i: number = 0; function sum2(x: number, y: number): number { i += x + y; return x + y; } // 3 function sum3(x: number, y: number): number { return x + y + i; } // 4 function sum4(x: number, y: number): number { const result = x + y; console.log(result); return result; } ७ਮͳؔͱ ΓඞͣҾͱͯ͠༩͑ΒΕ͔ͨΒͷΈܭࢉ͞ΕΔ ؔͷ֎෦Ͱมߋ͞ΕΔՄೳੑͷ͋ΔσʔλʹҰґଘ͠ͳ͍ ࣮ؔߦ෦ͷ֎ଆʹଘࡏ͢ΔԿ͔͠Βͷঢ়ଶΛҰมߋ͠ͳ͍
number { return x + y; } // άϩʔόϧมΛมߋ͍ͯ͠Δ let i: number = 0; function sum2(x: number, y: number): number { i += x + y; return x + y; } // Γ͕Ҿ͚ͩ͡Όͳ͘άϩʔόϧมʹґଘͯ͠Δ function sum3(x: number, y: number): number { return x + y + i; } // console.log ͱ͍͏શʹ֎ͷੈքʹׯবͯ͠Δ function sum4(x: number, y: number): number { const result = x + y; console.log(result); return result; }
public updateFirstName(name: string): User { return new User(name, this.lastName); } public updateLastName(name: string): User { return new User(this.firstName, name); } public greet(): string { return `hello, ${this.firstName} ${this.lastName}!!`; } }
public updateFirstName(name: string): User { return new User(name, this.lastName); } public updateLastName(name: string): User { return new User(this.firstName, name); } public greet(): string { return `hello, ${this.firstName} ${this.lastName}!!`; } } ΦϒδΣΫτ$MBTTͱͯ͠ఆٛ͢Δ ֤ϝιουͷ࠷ޙʹࣗͷ৽͍͠ΠϯελϯεΛΓʹฦ͢ ຖճ৽͍͠ΠϯελϯεΛͦͷ࣌ͷ෦͔Βੜ͢Δ ݺͼग़͠ͷίϯϑϦΫτ͕ൃੜ͠ͳ͍