3) JavaScript - Advanced Topics (Checkpoints 18-21)

Description

Quiz on 3) JavaScript - Advanced Topics (Checkpoints 18-21), created by Sanny Lin on 03/24/2016.
Sanny Lin
Quiz by Sanny Lin, updated more than 1 year ago
Sanny Lin
Created by Sanny Lin about 10 years ago
12
0

Resource summary

Question 1

Question
Which of these is an object constructor?
Answer
  • function Bunny(type) { this.type = type; }
  • var Bunny = {type: ""chocolate""};
  • Bunny.create();
  • Object.create(Bunny);

Question 2

Question
function Star() { // function body }; var andromeda = new Star(); How might you visually depict the prototype chain of `andromeda`?
Answer
  • andromeda --> Star.prototype --> Object.prototype --> null
  • andromeda --> Star --> Function.prototype --> Object.prototype --> null
  • andromeda --> Star.prototype -> Function.prototype --> Object.prototype --> null
  • andromeda --> Star --> Object.prototype --> null

Question 3

Question
var numbers = [4, 84, 9, 7, 33]; numbers.length; // returns 5 numbers.length = 4; Given the code above, what will `numbers.length` return?
Answer
  • 4
  • 5
  • undefined
  • null

Question 4

Question
x = ["y", "z"]; console.log(typeof x); What prints to the console?
Answer
  • "object"
  • "array"
  • null
  • undefined

Question 5

Question
var myString = "This is a string!"; myString.length; True or false: In this example, `length` is an own property on `myString`.
Answer
  • True
  • False

Question 6

Question
var protoFrog = { // some properties }; var greenFrog = Object.create(protoFrog); How might you visually depict the prototype chain of `greenFrog`?
Answer
  • greenFrog --> protoFrog --> Object.prototype --> null
  • greenFrog --> protoFrog.prototype --> Object.prototype --> null
  • greenFrog --> Object.prototype --> null
  • none of these
Show full summary Hide full summary

Similar