FAQ: Code Challenges - Code Challenge 15

This community-built FAQ covers the “Code Challenge 15” exercise from the lesson “Code Challenges”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn Node-SQLite

FAQs on the exercise Code Challenge 15

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

console.log() vs printQueryResults()
Could someone clarify the appropriate times to use console.log() vs printQueryResults()? This is the second time my code was wrong due to selecting printQueryResults() instead of using console.log().
Specifically, I’m in Web Development>Building a Persistent API>Learn Node-SQLite>Code Challenges>Exercise 15 found at:

https://www.codecademy.com/paths/web-development/tracks/building-a-persistent-api/modules/learn-node-sqlite-module/lessons/node-sqlite-code-challenges/exercises/code-challenge-15

I searched the internet but didn’t find a clear explanation, YET. So if anyone could point me to the topic online or help clarify the use of each contrasting when each is the ‘appropriate’ function to use, I’d be grateful as I’m sure others would be too.

Yeah, I’d love to know that as well!
Seems like these challenges are all using console.log() in their validation tests.
We can see it here, in ./test/test.js:

    let structure = function() {
      const logFloorsForAddress = address => {
        db.get($query, $parameter, ($errName, $row) => {
          console.log($row.number_of_floors);
        });
      }
    }

That is why we cannot use printQueryResults(): their tests are designed to only accept the structure specified. Although it should accept both, since they would both successfully run the query and print the result accordingly.