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?
- To define user interfaces
- To manage database connections
- To provide functionalities out of the box (correct)
- To enhance graphical processing
Which of the following accurately describes the Document Object Model (DOM)?
Which of the following accurately describes the Document Object Model (DOM)?
- It is the structure of JavaScript code.
- It solely enables CSS styling.
- It allows JavaScript to interact with browser content. (correct)
- It represents the programming interface for web servers.
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}$?
- Math.SQRT2
- Math.PI
- Math.E
- Math.SQRT1_2 (correct)
Which method is used to find the highest value among given numbers?
Which method is used to find the highest value among given numbers?
What statement about the Date object is false?
What statement about the Date object is false?
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?
Which Math property is not commonly accessed using the Math object?
Which Math property is not commonly accessed using the Math object?
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$?
What is the output of Math.random()?
What is the output of Math.random()?
Which of the following describes a property of JavaScript Math methods?
Which of the following describes a property of JavaScript Math methods?
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?
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?
Which of the following are the correct types of window popup boxes?
Which of the following are the correct types of window popup boxes?
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?
What is the key characteristic of a Confirm Box?
What is the key characteristic of a Confirm Box?
Which statement about the prompt box is untrue?
Which statement about the prompt box is untrue?
Which statement does not pertain to the concept of HTML DOM?
Which statement does not pertain to the concept of HTML DOM?
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?
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?
Which method allows you to set date values for a date object?
Which method allows you to set date values for a date object?
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?
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?
Which model allows JavaScript to interact with browser-specific functionalities?
Which model allows JavaScript to interact with browser-specific functionalities?
Objects in JavaScript act as containers for which two components?
Objects in JavaScript act as containers for which two components?
Which built-in object is designed for performing mathematical operations?
Which built-in object is designed for performing mathematical operations?
What objects are part of the Browser Object Model (BOM)?
What objects are part of the Browser Object Model (BOM)?
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?
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?
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?
What syntax correctly changes the content of an HTML element?
What syntax correctly changes the content of an HTML element?
Which option demonstrates the correct way to modify an element's style?
Which option demonstrates the correct way to modify an element's style?
Which of the following is NOT considered an event in JavaScript?
Which of the following is NOT considered an event in JavaScript?
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!'; ?
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?
Which activity does NOT generate an event in the HTML DOM?
Which activity does NOT generate an event in the HTML DOM?
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?
How can you ensure code runs after the webpage finishes loading?
How can you ensure code runs after the webpage finishes loading?
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?
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'?
Flashcards
Built-in Objects
Built-in Objects
Pre-defined objects in JavaScript that offer ready-made functionalities.
DOM (Document Object Model)
DOM (Document Object Model)
A programming interface for creating, changing or removing elements (content) from a document.
Math.SQRT2
Math.SQRT2
Returns the square root of 2.
Math.LN10
Math.LN10
Signup and view all the flashcards
Math.min()
Math.min()
Signup and view all the flashcards
Math.floor()
Math.floor()
Signup and view all the flashcards
Date object
Date object
Signup and view all the flashcards
Math.properties
Math.properties
Signup and view all the flashcards
Math methods
Math methods
Signup and view all the flashcards
Date Methods
Date Methods
Signup and view all the flashcards
Date object setting
Date object setting
Signup and view all the flashcards
String Object Manipulation
String Object Manipulation
Signup and view all the flashcards
charAt() method
charAt() method
Signup and view all the flashcards
String extraction methods
String extraction methods
Signup and view all the flashcards
Browser Object Model (BOM)
Browser Object Model (BOM)
Signup and view all the flashcards
JavaScript Objects
JavaScript Objects
Signup and view all the flashcards
JavaScript Math object
JavaScript Math object
Signup and view all the flashcards
BOM objects
BOM objects
Signup and view all the flashcards
Window.close()
Window.close()
Signup and view all the flashcards
Screen.availWidth
Screen.availWidth
Signup and view all the flashcards
Window Location Object
Window Location Object
Signup and view all the flashcards
window.location.assign()
window.location.assign()
Signup and view all the flashcards
window.location.hostname
window.location.hostname
Signup and view all the flashcards
window.history
window.history
Signup and view all the flashcards
history.back() and history.forward()
history.back() and history.forward()
Signup and view all the flashcards
Alert Box
Alert Box
Signup and view all the flashcards
Confirm Box
Confirm Box
Signup and view all the flashcards
Prompt Box
Prompt Box
Signup and view all the flashcards
document.getElementByClassName()
document.getElementByClassName()
Signup and view all the flashcards
innerHTML property
innerHTML property
Signup and view all the flashcards
Change HTML content
Change HTML content
Signup and view all the flashcards
Change HTML style
Change HTML style
Signup and view all the flashcards
HTML events
HTML events
Signup and view all the flashcards
Event Handling
Event Handling
Signup and view all the flashcards
Click Event
Click Event
Signup and view all the flashcards
Load Event
Load Event
Signup and view all the flashcards
Change Event
Change Event
Signup and view all the flashcards
JavaScript to change style on click
JavaScript to change style on click
Signup and view all the flashcards
innerHTML
innerHTML
Signup and view all the flashcards
style property
style property
Signup and view all the flashcards
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/2Math.LOG10E
: Returns the base-10 logarithm of Euler's number (e)Math.min()
: Returns the lowest value among the provided numbersMath.max()
: Returns the highest value among the provided numbersMath.abs()
: Returns the absolute value of a numberMath.random()
: Returns a random number between 0 (inclusive) and 1 (exclusive)Math.round()
: Rounds a number to the nearest integerMath.ceil()
: Rounds a number up to the nearest integerMath.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 indexsubstring()
: Extracts a portion of a stringsplit()
: 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 pagewindow.location.assign()
: Loads a new document into the browser by navigating to a new URL.window.close()
: Closes the current windowwindow.open()
: Opens a new browser windowscreen.width
: Retrieves the width of the browser's screen in pixelsscreen.height
: Retrieves the height of the browser's screen in pixelsscreen.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" buttonConfirm
box: Displays a message with a "OK" button and a "Cancel" buttonPrompt
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 elementstyle
: 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.