¿Quiere ver por qué la función printName() console.log no imprime el valor? ¿Cuál es el valor que tiene this ?
const person = { firstname: 'John', lastname: 'Muir', name: 'hello', fullname() { const name = 'Tim'; this.name = 'Tim'; console.log(JSON.stringify(this)); console.log('First name ' + this.firstname); console.log('Last name '+ this.lastname); printName = function () { console.log('name again ' + this.name); }; printName(); } } person.fullname();Producción
{"firstname":"John","lastname":"Muir","name":"Tim"} First name John Last name Muir name again undefined