JavaScript JavaScript and the DOM Making Changes to the DOM Getting and Setting Text with textContent and innerHTML

Gareth Partridge
Gareth Partridge
12,102 Points

Working in the Console

Why would you work and apply changes in a console ? what is the purpose of the console ? when making changes to a website through the console does it save those changes ?

or is the console just being used for teaching purposes ?

3 Answers

devina christabela
devina christabela
12,525 Points

If console by you mean the browser console, you can test manipulating DOM / using javascript on the console browser.. You don't need to be afraid something broken during your changes using console, you can always revert it back by refresh the browser window..

Gareth Partridge
Gareth Partridge
12,102 Points

So the console is used for testing purposes ?

devina christabela
devina christabela
12,525 Points

For me, I only use console for testing, tracing error, and see XHR Request..

Sean T. Unwin
MOD
Sean T. Unwin
Treehouse Moderator 28,636 Points

I would say that, yes, the console is primarily for testing/experimenting. It is a great resource when creating front-end content.

console.log() all the things you have a need to see what your data (e.g. variables) are at certain moments in the page's activities.

Setting breakpoints on your code with the Debugger tab is also very handy, especially for watching variables, and stepping through your code as it executes.

The other tabs, such as Network, Performance, Memory (depending on browser but similar naming) are very handy for checking various aspects of a page or SPA (Single Page Application).