JavaScript & jQuery by Jon Duckett

Hi all!

I was struggling with the projects so I decided I should do the recommended reading! I’m doing the full stack engineer course and I’m currently covering JavaScript. So, in the examples in the recommended reading, Duckett uses .textContent instead of console.log. I’m not sure what .textContent means. I can gather that it prints to the console, but I was hoping for a bit more detail, and when and why one is used over the other.

There is tons of online resources that tell you what certain things do. Here is what I use:

1 Like

@wafflejz Thanks! I read the article you linked. So it’s it for selecting elements from the HTML page? Because I haven’t covered how to do that yet!

Or is it, once the HTML elements have been selected, the .textContent updates the node?

Uh it might be. I don’t exactly know what you are talking about, as I am still kinda new to JavaScript. I shared that link because the website it’s on has helped me with other issues.

1 Like

In javascript there are two very important objects: console and document

so console.log() means we call the .log() method on the console object.

the console is mostly used for debugging, and codecademy uses the console because it allows learners to focus on learning the fundamentals of JavaScript without having to worry about the DOM and interaction with the DOM.

for selecting elements, we have different methods (like document.querySelector, MDN documentation)

textContent works two way, we can either change the text content of the node or we can read the textContent. Both are demonstrated in the MDN documentation.


Just wait for a TL3+ to give you help. They’ve always got the answers to every question.

Thank you!

Where would it be read?

I meant we extract the text from the element/node. This might be useful if you want to retrieve user input.

1 Like

Thank you! I think it’ll all come together in later chapters/ parts of the course.

Depending on the course you are taking, not all courses on codecademy include interaction with the DOM. Given this complicates things, Which might not be great if you just start learning javascript

I’m doing the full stack engineer course. So we are covering the DOM.

1 Like