Introduction To Es6 Quiz

Objectives

  1. Test your understanding of ES6 syntax
  2. Review Javascript principles

ES6 Quiz

var declares a block-scoped variable

True
False

const declares a block-scoped variable

True
False

let declares a block-scoped variable

True
False

What is the final value of obj in the following example?

const obj = { foo: 1 }

obj.bar = 2

{ foo: 1 }
N/A, the above throws an error
{ foo: 1, bar: 2 }
{ foo: 1, 2: bar }

Which of the following statements is not true about this example?

const obj = {
  outer: function() {
    const self1 = this

    const inner1 = () => {
      const self2 = this

      const inner2 = () => {
        const self3 = this
      }
    }
  }
}

self1 === self3
self2 === self3
self1 === self2
self2 !== self3

Which of the following statements is not true about this example?

const obj = {
  outer: function() {
    const self1 = this

    function inner1() {
      const self2 = this

      function inner2() {
        const self3 = this
      }
    }
  }
}

self1 !== self3
self2 !== self3
self1 === self2
self2 !== self3

What would be the constructor of roger in the example below?

class Animal {
  constructor(noise) {
    this.noise = noise
  }

  speak() {
    console.log(this.noise)
  }
}

class Dog extends Animal {
  constructor(size) {
    super('bark!')

    this.size = size
  }
}

const roger = new Dog('large')

Animal
Dog
Object
Function

What is the result of the following?

const speed = 'quick'

`The ${speed} brown fox jumps over the lazy dog.`

TypeError
SyntaxError
'The speed brown fox jumps over the lazy dog.'
'The quick brown fox jumps over the lazy dog.'

Select the value of obj[123]

const obj = {

}

undefined
'party!'

What is the final value of array below?

const array = [1, 2, 3]
const extension = [4, 5, 6]

array = [...extension, ...array]

[1, 2, 3]
[1, 2, 3, 4, 5, 6]
[4, 5, 6, 1, 2, 3]

Unlock your future in tech
Learn to code.

Learn about Flatiron School's Mission

With a new take on education that falls somewhere between self-taught prodigy and four-year computer science degree, the Flatiron School promises to turn students with little programming experience into developers.

In the six months since the Manhattan coding school was acquired by WeWork, it has spawned locations in Washington, D.C., Brooklyn, and London. Now, WeWork is opening a fourth Flatiron School location, this time in Houston.

Adam Enbar, Flatiron School's cofounder, believes now is the time to grow. "How the world is changing has impacted working and learning in very similar ways. We think education fundamentally is about one thing: enabling people to pursue a better life."

Learn. Love. Code.
Students come to Flatiron School to change their lives. Join our driven community of career-changers and master the skills you need to become a software engineer or a data scientist.
Find Us