Lesson 5: DOM Objects and Built-In Objects Flashcards
What is BOM (DOM)?
the Browser Object Model.
What are two window methods?
alert() and prompt()
What is returned if the user clicks the cancel button on a prompt popup?
Null value.
What does confirm(“msg”) do?
Return true or false depending on which button is clicked on the popup.
Show an example of confirm():
let answer = confirm("is 3+2=5?"); if (answer==true) (alert("correct"); } else {alert("wrong"); }
What does getElementBiId() do?
Returns a reference to an element with the id specified.
Show an example of getElementById:
const h1 = document.getElementById('title');
What is innerHTML used for?
Setting or changing element content.
What does the window.history object do?
Stores a list of the URLs previously visited using the current browser tab.
What does the location object contain?
Information about the currently loaded page.
What does the navigator object contain?
Data about the browser application.
Math.abs(a):
Returns the absolute value of a.
Math.celi(a):
Rounds a up to the next integer.
Math.floor(5.8):
Rounds a down to the next integer.
Math.round(a):
Rounds a to the nearest integer.