Fullstack Javascript Test
Es2015

ECMAScript 2015+

Question #33

The following code snippet is valid in modern JavaScript. It uses many concepts and it will run without any errors (but basically does nothing useful):

(async x => {
  const { mystery: fun } = {
    [x]: (a = 3, { b = 3 } = {}) => value => [a * b],
  };
  [x] = await fun(2)('TEST');
  console.log(x);
})(`${'my'}stery`);

Which of the following JavaScript concepts is NOT used within this code snippet?

A) Destructuring an array

B) Closures

C) Object literal shorthand property name

D) Object literal computed property name

Question #34

How do you define a static method X in a JavaScript class?

A)

#X() {
}

B)

static X() {
}

C)

X() static {
}

D) You can’t! JavaScript classes don’t support any static method syntax.

Question #35

What is the value of dessert.type after executing this code?

const dessert = { type: 'pie' };
dessert.type = 'pudding';

A) pudding

B) pie

C) The code will throw an error

D) undefined

Question #36

Which of the following is a valid string value in JavaScript?

A)

'This is a ${'test'}'

B)

"This is a ${"test"}"

C)

`This is
a ${'test'}`

D)

'This is
a test'

Question #37

JavaScript "Strict Mode":

A) Eliminates some JavaScript silent errors by changing them to throw errors.

B) Fixes mistakes that make it difficult for JavaScript engines to perform optimizations

C) Prohibits some syntax likely to be defined in future versions of the language

D) All of the above

Question #38

Which of the following will result in the variable fourth having the value 40?

A) const {4: fourth} = [10, 20, 30, 40];

B) const [first, second, fourth] = [10, 20, 30, 40];

C) const {first, second,, fourth} = [10, 20, 30, 40];

D) const [first, second,, fourth] = [10, 20, 30, 40];

Question #39

What is the name of a function whose execution can be suspended and resumed at a later point?

A) Async/Await function

B) Promise function

C) Arrow function

D) Generator function

Question #40

How do you import the lodash library making its top-level API available as the _ variable?

A) import lodash as _ from 'lodash';

B) import _ from 'lodash';

C) import 'lodash' as _;

D) import '_' from 'lodash';