Which JavaScript engine is used by both Google Chrome and Node.js?
V8 (written in C++ by Google) powers Chrome, Edge, Node.js and Deno. SpiderMonkey is Firefox's engine, JavaScriptCore is Safari's, and Chakra was the old Edge engine.
JavaScript Basics · Exercise 1 of 4
Fifteen multiple-choice questions on JavaScript basics: engines and ECMAScript, Node.js, defer and async, identifiers and reserved words, comments, semicolons and ASI, template literals, typeof and strict mode. Pick an option to check your answer instantly.
Which JavaScript engine is used by both Google Chrome and Node.js?
V8 (written in C++ by Google) powers Chrome, Edge, Node.js and Deno. SpiderMonkey is Firefox's engine, JavaScriptCore is Safari's, and Chakra was the old Edge engine.
Which statement about JavaScript is true?
Variables carry no type, one call stack runs your code, and the event loop handles asynchronous work. Engines compile it just in time, and Node.js runs it outside the browser.
How is JavaScript related to ECMAScript?
TC39 publishes the ECMAScript specification every year (ES2015 = ES6). Engines implement it; browsers and Node.js add APIs such as the DOM or fs on top.
Three scripts in the <head> depend on each other and must run in order, after the HTML is parsed, without blocking parsing while they download. Which attribute should they use?
defer downloads in parallel and executes in document order once parsing finishes. async executes each script as soon as it arrives, so the order is not guaranteed; no attribute blocks parsing.
Which of these is a valid JavaScript variable name?
Identifiers may contain letters, digits, _ and $ but cannot start with a digit. The hyphen is the minus operator, and new is a reserved word.
Which of these words is reserved and can never be used as a variable name?
typeof is an operator keyword. undefined is a read-only global but not a reserved word (it can even be shadowed inside a function), of is only a keyword inside for…of, and name is an ordinary identifier.
What happens with the line /* outer /* inner */ still outer */ in a script?
Block comments do not nest. The first */ closes the comment, and the remaining text is invalid code. Use // for commenting out code that already has block comments.
Which statement about Automatic Semicolon Insertion (ASI) is correct?
return, break, continue and throw are "restricted productions": a line break after them always ends the statement. Elsewhere a semicolon is inserted only where the next token cannot continue the code. Strict mode does not change ASI.
In strict mode, what happens when you assign to a variable that was never declared, e.g. total = 50;?
Non-strict code silently creates a global property; strict mode throws ReferenceError: total is not defined, catching typos early.
Which code runs in strict mode even without a "use strict" directive?
Modules (type="module", .mjs, import/export) and class bodies are always strict. Arrow functions, try blocks and let/const follow the strictness of the surrounding code.
Timed online tests with instant scores and explanations.