Outputs in JavaScript (OCR A-Level Computer Science): Flashcards
📚Flashcards
Practise the cards
10 cards from this deck
ShowHide
Practise the cards
10 cards from this deck
Purpose of console.log()
Purpose of console.log()
Outputs information to the browser's console
Purpose of alert()
Purpose of alert()
Displays a pop-up message
What document.write() does
What document.write() does
Writes output directly to the HTML document
What innerHTML does
What innerHTML does
Writes output directly to an HTML element
Main output methods in JavaScript
Main output methods in JavaScript
console.log(), alert(), document.write(), innerHTML
Common mistake with document.write()
Common mistake with document.write()
It overwrites the document
When to use console.log()
When to use console.log()
For debugging
When to use alert()
When to use alert()
For interacting with users
How often should document.write() be used
How often should document.write() be used
Sparingly
Output destinations in JavaScript
Output destinations in JavaScript
Alerts, HTML elements, browser console
