HomeTriviaTech & GamesJavaScript
concept🎮 Tech & Games

JavaScript Trivia Questions

How much do you really know about JavaScript? Below are 8 true or false statements. Click each one to reveal the answer and explanation.

1.

JavaScript was originally developed in just 10 days by Brendan Eich.

Click to reveal answer ›

Easy
✓ TRUE

Brendan Eich created the first version of JavaScript in May 1995 in only 10 days while at Netscape.

2.

JavaScript can accurately handle numbers like 0.1 + 0.2 without floating-point errors.

Click to reveal answer ›

Medium
✗ FALSE

0.1 + 0.2 equals 0.30000000000000004 due to IEEE 754 binary floating-point representation, a common gotcha.

3.

Using 'new Array(5)' creates an array with five undefined elements, not empty slots.

Click to reveal answer ›

Medium
✗ FALSE

It creates an array with 5 empty slots (sparse array), not elements set to undefined. You need .fill() to populate them.

4.

JavaScript's 'Array.sort()' sorts numbers correctly by default without a compare function.

Click to reveal answer ›

Medium
✗ FALSE

It sorts elements as strings by default, so [10, 2] becomes [10, 2] not [2, 10]. You must pass a numeric compare function.

5.

The '==' operator in JavaScript always performs type coercion before comparison.

Click to reveal answer ›

Medium
✗ FALSE

'==' does coerce, but not always—if both operands are the same type, it behaves like '===' without coercion.

6.

JavaScript's 'typeof null' returns 'object' due to a bug from the first version.

Click to reveal answer ›

Hard
✓ TRUE

This is a long-standing bug where null is typed as 'object' because of a type tag error in the original 1995 implementation.

7.

The 'void' operator in JavaScript always returns the value 'undefined' regardless of operand.

Click to reveal answer ›

Hard
✓ TRUE

'void' evaluates its operand and returns undefined, commonly used to get the primitive undefined value safely.

8.

You can use 'undefined' as a variable name in modern JavaScript without causing an error.

Click to reveal answer ›

Hard
✓ TRUE

'undefined' is not a reserved word, so you can assign to it (e.g., var undefined = 10) in non-strict mode, though it's terrible practice.

More in Tech & Games

MinecraftTrivia Questions →ChessTrivia Questions →TetrisTrivia Questions →Super MarioTrivia Questions →The Legend of ZeldaTrivia Questions →
View all Tech & Games topics →

Want to test yourself in real time?

Swipe right for True, left for False. New questions every day on PopBluff.

Play PopBluff Free →