I’m using Chrome right now to take these courses (not sure if that matters) and the test output worked great in the HTML and CSS courses. But I’m finding that for the challenges in the Basic JS course, I either have to wing it and hope that my solutions are right or sometimes I can “console.log” the test inputs that are at the end of the challenges.
For example, the Record Collection challenge doesn’t give me any useful information as I’m writing the code and I can’t wrap the test function in a console.log because it just logs the type as “object”.
The end of that challenge says to change these value to test the code but then there’s nothing in the output other than:
- Your test output will go here.
From what you’re saying, I’m guessing you’re using the FCC log, which is great and useful, but by no means complete. Instead, in your chrome browser, pressing
<f12> will open Chrome’s Developer Tools, which includes a very powerful console. There, rather than seeing [Object], you would get the actual Object output.
I tend to add console.log statements throughout my function (for example, on the record collection lesson, in each branch of the if statement, I added a
console.info("In the add a track, and we got no track!"); or
console.info("Deleting the property "+prop); – mixing both an informational message and a variable there).
There are a number of different options for console:
console.log(...) lets you log output to the console. lets you mix strings and variables. Pretty standard.
console.info(...) very very similar to console.log, often more informational (at least when I use it).
console.warn(...) issue a warning. For example, when deleting a property, a “this is destructive!!” warning could be in order.
console.error(...) lets you display an error message in the console. For example, in this lesson, if you had an invalid id, it might make sense to
console.error("No record with that id!");