How Well Do You Know JavaScript? Take the Ultimate Quiz!


Gensen Huang
Idyllic Icon

Gensen Huang

Created 6/20/2024

90

64.94%

Q & A


Share This Quiz

Sources

https://andersonguelphjs.github.io/OReilly_JavaScript_The_Good_Parts_May_2008.pdf

Test your knowledge of JavaScript with this challenging quiz! How many correct answers can you get out of 20?

Test your knowledge of JavaScript with this challenging quiz! How many correct answers can you get out of 20?

1. Which of the following is true about 'typeof' operator in JavaScript?

It always returns an accurate type
It can return incorrect types like 'object' for null
It only works with primitive types
It is not a part of JavaScript

2. What is the role of Function.prototype.method in JavaScript?

To create a new method
To define new methods on function prototypes
To call methods
To delete a method

3. What does the void operator return in JavaScript?

null
0
undefined
false

4. What is required before a regular expression literal to avoid ambiguity in JavaScript?

A number
Whitespace
A ( or = or : or , character
A letter

5. What is the purpose of the 'use strict' directive in JavaScript?

It enables automatic error correction in the code
It allows the use of older, deprecated JavaScript features
It enforces stricter parsing and error handling in your JavaScript code
It enhances the performance of JavaScript by optimizing the execution process

6. Which statement about functions in JavaScript is true?

Functions cannot be nested
Functions are hoisted if declared with the 'var' keyword
Functions are values
Functions do not have access to their own scope

7. How do you declare a function expression in JavaScript?

function foo() {}
var foo = function() {}
foo = () => {}
var foo = new Function()

8. Why is the use of == operator discouraged in JavaScript?

It is slower than ===
It only compares objects
It attempts to coerce the values, leading to unexpected results
It is an old feature

9. Which form hides the true nature of JavaScript by mimicking class inheritance?

Functional form
Pseudoclassical form
Object specifiers
Prototypal form

10. What is a closure in JavaScript?

A type of array
An object
A function within another function with access to the outer scope
A regular expression

11. Which operator is overloaded in JavaScript's regular expression literals?

/
*
:
=

12. Which statement is true about JavaScript arrays?

They are primitive types
They are immutable
They are objects
They cannot be nested

13. Which of the following is true about JavaScript objects?

They must have a fixed structure
They are mutable
They do not support inheritance
They are class-bound

14. What is eval mainly used for in JavaScript?

Running JavaScript code strings
Creating objects
Accessing variables
Handling arrays

15. In Simplified JavaScript, what are functions described as?

First-class objects
Second-class objects
Primitive types
Utility types

16. The use of global variables in JavaScript:

Improves code transparency
Complicates behavior
Facilitates modular coding
Enhances functionality

17. What does the term 'hoisting' refer to in JavaScript?

Automatically moving declarations to the top of their scope
Converting primitives to objects
Graceful error handling
Inheriting methods from prototypes

18. Which JavaScript feature always returns undefined?

Null
Void
Eval
NaN

19. What is the recommended way to handle long parameter lists for constructors in JavaScript?

Using multiple constructors
Using an array
Using an object specifier
Using default parameters

20. What does the prototype chain in JavaScript ensure?

Classes and inheritance
Global variable access
Object property look-up
Immutable object instances