I'm trying to add a property to an object the following way:
function methodA(client, page){
Object.defineProperty(client, 'name', {
value: page,
writable: true,
enumerable: true,
configurable: true
});
methodB(client)
}
When I do a console log of client.name in methodB it returns undefined. Can someone point me out what I'm doing wrong ? I'm new to JS.
client.name = page;would probably be easier