const flightName = {
airline: 'luftansa',
itaCode: 'LH',
book: function(flightname, text) {
console.log(`This is ${flightname},${text}`);
}
}
flightName.book('indigo', 'johnny');
let book1 = flightName.book;
book1.call('Johnny', 'King');
Output:
This is indigo,johnny
This is King,undefined
>Solution :
Try this
const flightName ={
airline: 'luftansa',
itaCode: 'LH',
book: function(flightname,text)
{
console.log(`This is ${flightname},${text}`);
}
}
flightName.book('indigo','johnny');
let book1 = flightName.book;
book1.call(this, 'Johnny','King');