Different print out results on different sections editor and for/in


I have completed the lesson already, but I was having issues with the printouts. I initially started the codes with both literal notation and constructor so I can familiarize myself with both while doing the lesson. However, as I progress through the exercises I noticed the printouts were longer than expected compared to exercised 1 (What you'll be building). So I redid my codes to be more like the ones from exercise 1, but still my printouts just seems longer than expected. Although it would still pass me while I submit the codes, so I'm assuming the codes are right. Then at the end, exercise 8, using the same codes I wrote and I got the printout results I expect like from exercise 1. So then I copy and pasted my code to each different exercises editor and notice results from editors in exercise 1 and 8 is different from the rest of the exercises. I even comment out all the codes in the editor and was getting printouts of 3 friends objects.

  1. Anyone knows why this is? It was giving me a headache because I was checking every line of code dozens of times trying to figure out why it was giving different results.

2.This issue took my time away from studying the for/in loop. Which I had some problem understanding. Can anyone give me a more in depth explanation of the loop?
- in the codes:
var list = function(obj){
for(var prop in obj){
console.log(prop); }

It's logging prop for each key in obj right? so 'friends.bill' and 'friends.steve' should be the only ones printed once? And the reasoning is because these two are the children of friends object and the prop that was declared in this for loop is referring to these two keys?

var friends = {};
    friends.bill= {
    firstName: "Bill",
    lastName: "Clit",
    number: 555,
    address: ["Old mans country", "Big Dick County", "AA",  "12321"]
    friends.steve= {
    firstName: "Steve",
    lastName: "Erkel",
    number: 666,
    address: ["Simple Mind End", "Service provided", "DD", "99999"]

var list = function(obj){
    for(var prop in obj){
var search = function(name){
    for(var prop in friends){
        if(friends[prop].firstName === name){
            return friends[prop];


Because the code logs out results, the lesson check tests will also output. They can be ignored.


lesson check tests? Is that something imbed to the 'save and submit' button? Also, the abnormality only seems to happen in the editors of exercise 2-7, but NOT the 1 and 8. So the added printout are a result of the tests doing printouts?


Yes, as you observe there is a program embedded in the lesson called the Submission Correctness Test, or SCT. There are many different ways a course author can check our work, and running the code is just one of them. Sometimes the check is only for required elements in the code. It's not obvious or easy to assume. Staying as close to instructions and lesson concepts is how to get the best results with these exercises.


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