123456789101112131415161718192021
function People(name,sex){ this.name = name this.sex = sex this.hobbit = []}People.prototype.addHobbit = function(h){ this.hobbit.push(h) return this}People.prototype.todos = function(){ console.log('Looking for work.......')}var I = new People('Elsie','female')I.addHobbit('eat').addHobbit('sleep').addHobbit('coding').addHobbit('music').addHobbit('lose weight')while (true){ I.todos()}