Solución
solution.tsTypeScript
export function getPrototypeChain(value: unknown): string[] {
// Usa Object.getPrototypeOf() para recorrer la cadena de prototypes
// Para cada nivel, captura constructor.name
// Detente cuando el prototype sea null
const prototypesNames: string[] = [];
// Captura el prototipo
let prototypeOfValue = Object.getPrototypeOf(value);
while ( prototypeOfValue !== null) {
// Agrega el nombre del constructor del prototipo
prototypesNames.push( prototypeOfValue.constructor.name );
// Captura el prototipo del prototipo y continúa mientras
// no llega al final de la cadena => prototipo = null
prototypeOfValue = Object.getPrototypeOf( prototypeOfValue );
}
return prototypesNames;
}0respuestas