List Function: "Console.log not a function"


From "6. List 'em all" on the contact list project for java

This is my code for the list function:

var list = function (object) {
  for (var key in object) {
    console.log = (key);

list (friends);

However, searching through these forums I've seen almost exclusively:


I've tried both ways. With the " = ", I get "Looks like your function isn't printing right" with no output. With "console.log(key)", I get "Did you create a function called list?", and the output is an error message that reads:

TypeError: console.log is not a function. (In 'console.log(prop)', 'console.log' is "steve")

I've tried copy and pasting multiple solutions from the forums, as well as the final code from the full program itself shown on lesson 1; but I still can't get past this step. What do I do?

It's probably going to be something stupidly obvious, like I missed a semicolon.


console.log = (key); // WRONG syntax
console.log(key); // correct syntax

I've tried your function and it's works fine. So, try to clear cache or another browser but please use correct syntax for console.log() method.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.