var employee = {
["Last Name"]: "Smith",
["First Name"]: "Josh",
["Full Name"]: function() {
return this["First Name"] + this["Last Name"]
}
};
document.write("Good day" + this["Full Name"])
I'm currently learning JavaScript and I wanted to create an object with properties in two words using the bracket notation, unfortunately it gives me a result of Good dayundefined instead of Good day Josh Smith. I don't know what supposed to be the problem of my code...
document.write("Good day" + employee["Full Name"]()), note the extra set of parens at the end.thisoutside an object method.employee["Full Name"]().