interface Person2 {
name: string;
age?: number;
}
function hello2(person: Person2): void {
console.log(`안녕하세요! ${person.name}입니다.`);
}
hello2({ name:'Mark', age: 39 });
hello2({ name:'Anna' });
"use strict";
function hello2(person) {
console.log(`안녕하세요! ${person.name}입니다.`);
}
hello2({ name: 'Mark', age: 39 });
hello2({ name: 'Anna' });
interface Person3 {
name: string;
age?: number;
[index: string]: any
}
function hello3(person: Person3): void {
console.log(`안녕하세요! ${person.name}입니다.`);
}
const p31: Person3 = {
name: "Mark",
age: 39
};
const p32: Person3 = {
name: "Anna",
sisters: ["Luna", "Jennie"]
};
const p33: Person3 = {
name: "James",
father: p31,
mother: p32
}
hello3(p33);
"use strict";
function hello3(person) {
console.log(`안녕하세요! ${person.name}입니다.`);
}
const p31 = {
name: "Mark",
age: 39
};
const p32 = {
name: "Anna",
sisters: ["Luna", "Jennie"]
};
const p33 = {
name: "James",
father: p31,
mother: p32
};
hello3(p33);