- Write into an HTML element
- Write to the browser console
- Write into a pop-up box
- Write into the page
Write to an HTML element:
document.getElementById(status).innerHTML = “You are Awesome”;
Writing to the console:
This output (you guessed it) outputs into the browser console. Normally this is good for debugging. Again the syntax is just “Hey console, log this message.” You can also do console.dir which prints the element in a JSON-like tree vs. in the HTML format as found with console.log. If you are not sure what the console is, enable your browser's developer tools and you should see an option to view console.
Writing to an Alert Box:
This is generally used to alert the user in a way that breaks out of the normal UI and is really effective in grabbing the user’s attention. It's also possible you have seen such elements when visiting websites that are full of annoying ads.
Writing to the Page:
In the end, as you embark on building your JS functions and applications, no doubt at some point you will end up using one of these functions.