JavaScript Built-in Objects Quiz
24 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What method is used to set date values for a date object?

  • Object Method
  • Date Method
  • Get Method
  • Date Set Method (correct)
  • Which of the following methods is NOT a part of the String Object?

  • charAt()
  • split()
  • substring()
  • Math.sqrt() (correct)
  • Which method would you use to retrieve the character at a specific position in a string?

  • charAt() (correct)
  • substring()
  • indexOf()
  • toString()
  • What is the primary purpose of the Browser Object Model (BOM)?

    <p>To interact with browser-specific functionalities</p> Signup and view all the answers

    In JavaScript, what are the two main components that objects serve as containers for?

    <p>Properties and methods</p> Signup and view all the answers

    Which object would you use in JavaScript to perform mathematical tasks?

    <p>Math object</p> Signup and view all the answers

    What method can you use to close the current window in the browser?

    <p>Window.close()</p> Signup and view all the answers

    To return the width of the visitor's screen in pixels, which object and property would you use?

    <p>Screen.width</p> Signup and view all the answers

    Which of the following accurately describes the built-in objects in JavaScript?

    <p>They provide functionalities such as mathematical calculations and array manipulation.</p> Signup and view all the answers

    What is the purpose of the Document Object Model (DOM)?

    <p>It facilitates interaction with browser-specific functionalities and document representation.</p> Signup and view all the answers

    Which statement about the Date object is incorrect?

    <p>The Date object can format dates but cannot manipulate them.</p> Signup and view all the answers

    Which method retrieves the highest value among given numbers?

    <p>Math.max(x,y,z,...n)</p> Signup and view all the answers

    What syntax would you use to retrieve the base 10 logarithm of a number?

    <p>Math.LOG10E</p> Signup and view all the answers

    What is the correct syntax to round a number down to the nearest integer?

    <p>Math.floor(x)</p> Signup and view all the answers

    Which of the following statements about JavaScript Math properties is false?

    <p>Math methods can be called without any arguments.</p> Signup and view all the answers

    Which method allows you to adjust date objects by setting specific date and time components?

    <p>Date.setUTC()</p> Signup and view all the answers

    What method should be used to load a new document in the window location object?

    <p>window.location.assign()</p> Signup and view all the answers

    Which methods can be used to navigate back and forward in the browsing history?

    <p>history.back() and history.forward()</p> Signup and view all the answers

    Which of the following describes the three window popup boxes correctly?

    <p>Alert box, confirm box and prompt box</p> Signup and view all the answers

    What is the purpose of a confirm box?

    <p>To verify or accept something by clicking 'OK' or 'Cancel'</p> Signup and view all the answers

    Which statement is false regarding a prompt box?

    <p>It returns true if 'OK' is pressed.</p> Signup and view all the answers

    Which of the following methods is not part of the HTML DOM concept?

    <p>JS can format existing HTML elements.</p> Signup and view all the answers

    What is the correct method to access elements by their class name in a document object?

    <p>document.getElementsByClassName(name)</p> Signup and view all the answers

    How can you modify the content of an HTML element most easily?

    <p>By using the innerHTML property</p> Signup and view all the answers

    Study Notes

    Built-in Objects

    • Pre-defined objects providing functionalities
    • Included in the browser environment

    Document Object Model (DOM)

    • Enables JavaScript to interact with the browser
    • Collection of objects exposed by the browser
    • Allows JS to interact with the browser window, document, and other browser-specific functionalities
    • Provides an interface to create, change or remove elements within a document.

    Mathematical Constants and Methods

    • Math.SQRT1_2: Returns the square root of 1/2
    • Math.LOG10E: Returns the base-10 logarithm of e
    • Math.min(): Returns the lowest value among input parameters
    • Math.max(): Returns the highest value among input parameters
    • Math.abs(): Returns the absolute value of a number
    • Math.random(): Generates a random number

    Date Object

    • Represents dates and times in JavaScript
    • Allows creating and manipulating dates
    • Extracts specific components (year, month, day, hour, minute, second)

    Window and Screen Object

    • Screen.availWidth: Returns width of user's display minus the interface (like taskbar)
    • Screen.width: Returns the total width of the screen.
    • Window.location.href: Returns the URL of the current page.
    • Window.location.assign(): Loads a specified URL

    History Object

    • history.back(): Loads the previous URL.
    • history.forward(): Loads the next URL.
    • Alert Box: Informs the user.
    • Confirm Box: Asks a yes/no question.
    • Prompt Box: Asks for input

    HTML Document Object Model (DOM)

    • The HTML DOM allows you to execute code when an event occurs
    • Used to change the styles and content of elements.
    • document.getElementById(): Finds an element by its ID.
    • document.getElementByTagName(): Finds elements by tag name.
    • document.getElementByClassName(): Finds elements by class name.
    • innerHTML: Modifies the content of an element, typically used to display or change content.
    • style.property: Modifies styling of an element.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    JS WK9 PDF

    Description

    Test your knowledge on the built-in objects in JavaScript, including the Document Object Model (DOM) and mathematical constants. This quiz covers functionalities that enable JavaScript to interact with the browser, manipulate dates, and perform mathematical operations. Enhance your understanding of these essential JavaScript concepts.

    More Like This

    Use Quizgecko on...
    Browser
    Browser