var name = [];
function logger(names) {
if (typeof names === "string") {
console.log(names);
} else if (typeof names === "object") {
for (var name in names) {
console.log(names.names);
}
}
}
function namesIn(namesData, functionality) {
name.push(namesData);
functionality(namesData);
}
namesIn({
names: ["Michael", "Sally", "Billy", "Dinesh", "Zach"]
}, logger);
When I go to view my log in chrome I am greeted with this particular error message which is puzzling: "TypeError: name.push is not a function".
What is the problem?