Study

Web 103 Mid-Semester Review

  •   0%
  •  0     0     0

  • Which two symbols create an "arrow" for function definitions in JavaScript?
    => (equals sign, greater-than sign)
  • What is the first keyword needed to create a for loop?
    for
  • True or False: when defining a function, a name is always required
    False
  • When this code runs, what message will appear?
    "I am 7 years old!"
  • What will be alerted when this code runs?
    Timmy is an average kid
  • Write code to filter this array so that it only includes family members who are less than 18 years old.
    family.filter(m => m.age < 18)
  • What will be alerted when this code runs?
    110
  • Which function will grab a full HTML element in JavaScript?
    document.querySelector
  • What will be alerted when this code runs?
    5
  • True or False: In JavaScript, functions can be stored in variables
    True
  • In the names array, "Jimothy" is at which index?
    2
  • Which HTML element can add a picture to a webpage?
    <img>
  • How could you set the age of this character to be 9?
    character.age = 9;
  • Convert this function into an arrow function
    x => x+1
  • Which JavaScript function can hookup an event listener to an HTML element?
    addEventListener
  • Which keyword is used to create variables?
    let
  • What will be alerted when this code runs?
    7
  • How many statements go between the parentheses in a for loop?
    3
  • The part of a function within curly brackets is called...
    the body
  • Write code to map this array of objects into an array of prices, each discounted 50%
    items.map(i => i.price/2)
  • Which function will create a new HTML element in JavaScript?
    document.createElement
  • Convert this function into an arrow function
    () => 5