面试题答案
一键面试function printLength(arg: string | any[]): void {
if (typeof arg ==='string') {
console.log(arg.length);
} else if (Array.isArray(arg)) {
console.log(arg.length);
}
}
function printLength(arg: string | any[]): void {
if (typeof arg ==='string') {
console.log(arg.length);
} else if (Array.isArray(arg)) {
console.log(arg.length);
}
}