console.log(contactInfo.display());
You need to call the function.
You currently just have console.log(contactInfo.display);
display is a function and is not being executed (so console will actually print the result of contactInfo.display.toString()
), that is why you see 'function' and not the return value 'contactCard'.