[Record Collection]Why when i try to console.log() the value of a property it logs the whole object

Hey guys,

I modified the code in the Record Collection exercise to check something in the console:

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "Little Red Corvette" 
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    "5439": {
      "album": "ABBA Gold"

var test = collection[2548].artist;

It’s weird to me, but it logs the whole collection object. How and why?

1 Like

Works for me - I get Bon Jovi in console.

1 Like

Worked just fine for me too. Are you using an odd browser? Sometimes Firefox and Safari act differently than M$ and Chrome.

1 Like

Ok, so it’s the browser’s fault. For a moment i was like "Whaaaaaaaaa…t : O "

I use chrome, don’t know why it occurs

Not necessarily. I’m using Chrome too. And it was just fine for me. Is it still doing it? You wanna paste the whole code (even the boiler plate)? Maybe you inadvertently changed something.

I gave up trying to figure it out. But then later, I have this in another challenge:


I click “Run tests” and nothing appears. Is it my fault here? Or another weird thing with chrome?

var contacts = [
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]

var test = contacts[0].likes;
1 Like

Okay so the problem seems to be that you are mistaking CodeMirror for the console. CodeMirror returns the results of the exercise’s function, in this case lookUpProfile(). If you haven’t defined the function, it returns nothing. To see your console.log, press F12 and make sure the Console is open.


Thanks, it’s not clear to me how to use console.log on FCC. I don’t have problems using it on codepen, but here nothing works in the console, when i try to log something from the website . For example console.log(contacts); does not work .

You are on Chrome, right? press ctrl-shift-I to open the console (the panel to the right on @bnoden 's screen pic). Sometime the Elements tab will be active, then just click the Console tab and you will be in business.

Awesome, #ChadKreutzer. Thank you, this solved my issues. Ghostery, dear Ghostery caused me plenty of problems! Only now did I understand why I get all the ‘security’ issues.