Podcast
Questions and Answers
What is the primary function of built-in objects in JavaScript?
What is the primary function of built-in objects in JavaScript?
Which of the following accurately describes the Document Object Model (DOM)?
Which of the following accurately describes the Document Object Model (DOM)?
Which syntax is correct to return the square root of $\frac{1}{2}$?
Which syntax is correct to return the square root of $\frac{1}{2}$?
Which method is used to find the highest value among given numbers?
Which method is used to find the highest value among given numbers?
Signup and view all the answers
What statement about the Date object is false?
What statement about the Date object is false?
Signup and view all the answers
What is the correct syntax to round a number down to its nearest integer?
What is the correct syntax to round a number down to its nearest integer?
Signup and view all the answers
Which Math property is not commonly accessed using the Math object?
Which Math property is not commonly accessed using the Math object?
Signup and view all the answers
Which method would you use to obtain the logarithm base 10 of $e$?
Which method would you use to obtain the logarithm base 10 of $e$?
Signup and view all the answers
What is the output of Math.random()?
What is the output of Math.random()?
Signup and view all the answers
Which of the following describes a property of JavaScript Math methods?
Which of the following describes a property of JavaScript Math methods?
Signup and view all the answers
What is the correct method to load a new document using the window location object?
What is the correct method to load a new document using the window location object?
Signup and view all the answers
Which methods can be called to navigate backwards and forwards in the history list?
Which methods can be called to navigate backwards and forwards in the history list?
Signup and view all the answers
Which of the following are the correct types of window popup boxes?
Which of the following are the correct types of window popup boxes?
Signup and view all the answers
What type of popup box requires the user to click 'OK' to proceed?
What type of popup box requires the user to click 'OK' to proceed?
Signup and view all the answers
What is the key characteristic of a Confirm Box?
What is the key characteristic of a Confirm Box?
Signup and view all the answers
Which statement about the prompt box is untrue?
Which statement about the prompt box is untrue?
Signup and view all the answers
Which statement does not pertain to the concept of HTML DOM?
Which statement does not pertain to the concept of HTML DOM?
Signup and view all the answers
Which method is best for accessing elements by class name in the document object?
Which method is best for accessing elements by class name in the document object?
Signup and view all the answers
What is the easiest way to modify the content of an HTML element?
What is the easiest way to modify the content of an HTML element?
Signup and view all the answers
Which method allows you to set date values for a date object?
Which method allows you to set date values for a date object?
Signup and view all the answers
What method is used to retrieve the character at a specified index in a string?
What method is used to retrieve the character at a specified index in a string?
Signup and view all the answers
Which methods are used to extract a portion of a string and split a string into an array?
Which methods are used to extract a portion of a string and split a string into an array?
Signup and view all the answers
Which model allows JavaScript to interact with browser-specific functionalities?
Which model allows JavaScript to interact with browser-specific functionalities?
Signup and view all the answers
Objects in JavaScript act as containers for which two components?
Objects in JavaScript act as containers for which two components?
Signup and view all the answers
Which built-in object is designed for performing mathematical operations?
Which built-in object is designed for performing mathematical operations?
Signup and view all the answers
What objects are part of the Browser Object Model (BOM)?
What objects are part of the Browser Object Model (BOM)?
Signup and view all the answers
Which method under the window object is used to close the current window?
Which method under the window object is used to close the current window?
Signup and view all the answers
To return the width of the user's screen in pixels minus interface features, which method should be used?
To return the width of the user's screen in pixels minus interface features, which method should be used?
Signup and view all the answers
To obtain the URL of the current page using the window location object, which property should be accessed?
To obtain the URL of the current page using the window location object, which property should be accessed?
Signup and view all the answers
What syntax correctly changes the content of an HTML element?
What syntax correctly changes the content of an HTML element?
Signup and view all the answers
Which option demonstrates the correct way to modify an element's style?
Which option demonstrates the correct way to modify an element's style?
Signup and view all the answers
Which of the following is NOT considered an event in JavaScript?
Which of the following is NOT considered an event in JavaScript?
Signup and view all the answers
What is incorrect about the following syntax for changing element content: document.getElementById('demo').innetHTML = 'Hello World!'; ?
What is incorrect about the following syntax for changing element content: document.getElementById('demo').innetHTML = 'Hello World!'; ?
Signup and view all the answers
Which code will successfully change the text color to blue upon a button click?
Which code will successfully change the text color to blue upon a button click?
Signup and view all the answers
Which activity does NOT generate an event in the HTML DOM?
Which activity does NOT generate an event in the HTML DOM?
Signup and view all the answers
Identifying a correct action, what does document.getElementById('p2').style.color = 'blue'; accomplish?
Identifying a correct action, what does document.getElementById('p2').style.color = 'blue'; accomplish?
Signup and view all the answers
How can you ensure code runs after the webpage finishes loading?
How can you ensure code runs after the webpage finishes loading?
Signup and view all the answers
In JavaScript, what does the syntax document.getElementById(id).style.property = new style aim to achieve?
In JavaScript, what does the syntax document.getElementById(id).style.property = new style aim to achieve?
Signup and view all the answers
What JavaScript code snippet will correctly change the text displayed in an element with id 'demo'?
What JavaScript code snippet will correctly change the text displayed in an element with id 'demo'?
Signup and view all the answers
Study Notes
Built-in Objects
- Pre-defined objects providing various functionalities
- Included right away
Document Object Model (DOM)
- JavaScript interacts with the browser
- Includes objects like Window, Navigator, Location, History, Screen
- Allows JavaScript to interact with the browser window, document, and other browser-specific functionalities
- Enables creation, modification, and removal of document elements
Mathematical Constants and Methods
-
Math.SQRT1_2
: Returns the square root of 1/2 -
Math.LOG10E
: Returns the base-10 logarithm of Euler's number (e) -
Math.min()
: Returns the lowest value among the provided numbers -
Math.max()
: Returns the highest value among the provided numbers -
Math.abs()
: Returns the absolute value of a number -
Math.random()
: Returns a random number between 0 (inclusive) and 1 (exclusive) -
Math.round()
: Rounds a number to the nearest integer -
Math.ceil()
: Rounds a number up to the nearest integer -
Math.floor()
: Rounds a number down to the nearest integer
Date Object
- Represents dates and times
- Includes year, month, day, hour, minute, and second
- Retrieves the current date and time
- Creates date/time values
- Allows manipulation of date-related information
String Object
- Sequence of characters
- Provides methods for manipulating and working with strings
String Object Methods
-
charAt()
: Retrieves the character at a specified index -
substring()
: Extracts a portion of a string -
split()
: Divides a string into an array of substrings
Window Object
- Interaction with the browser window
-
window.location.href
: Retrieves the URL (Uniform Resource Locator) of the current web page -
window.location.assign()
: Loads a new document into the browser by navigating to a new URL. -
window.close()
: Closes the current window -
window.open()
: Opens a new browser window -
screen.width
: Retrieves the width of the browser's screen in pixels -
screen.height
: Retrieves the height of the browser's screen in pixels -
screen.availWidth
: Retrieves the width of the screen available for the application, minus the operating system's interface elements. -
screen.availHeight
: Retrieves the height of the screen available for the application, minus the operating system's interface elements.
Window Popup boxes
-
Alert
box: Displays a message to the user, prompting a single "OK" button -
Confirm
box: Displays a message with a "OK" button and a "Cancel" button -
Prompt
box: Displays a message and input field, allowing the user to enter a value. Informs the user to make sure about needed actions
HTML DOM
- Provides a way of accessing and modifying elements in HTML (HyperText Markup Language)
-
document.getElementById()
: retrieves the element with the corresponding ID. -
document.getElementsByTagName()
: retrieves all elements with the corresponding tag. -
document.getElementsByClassName()
: retrieves all elements of the specified class. -
innerHTML
: Modifies the content within an HTML element -
style
: Modifies the CSS style attributes
HTML Events
- Execution of code when an event occurs on an HTML element
- Events are automatically triggered by the browser (e.g. page load, clicks, input changes)
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Explore the essential built-in objects and mathematical constants in JavaScript. This quiz covers the Document Object Model (DOM) and various Math methods that help in numerical computations and browser interaction. Test your knowledge on how JavaScript interacts with the browser and performs mathematical operations.