JavaScript, Engines and Runtime Environments
Quick answer
JavaScript is a programming language used to express computations and behavior. ECMAScript specifies the core language; an engine implements it, and a host supplies additional capabilities. A browser and Node.js can run the same arithmetic but expose different APIs.
How it works
Start in a JavaScript editor or console. The following line asks the host console to display a message. Run each example separately. The quotation marks delimit text and are not part of the message. console is a host facility, not a core ECMAScript built-in.
Expected console output (Node.js):
Hello, JavaScript!The console shows the message without quotation marks.
Expected console output (Node.js):
42The multiplication produces 42; the console displays it.
Common mistakes
Do not assume that a browser-specific API such as document exists in a Node.js program. Check the host before using an API. The console output does not automatically become visible text on a web page.
Practice
Run both examples, then change the message and the multiplication operands. Compare the output with your prediction.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
JavaScript, Engines and Runtime Environments — Knowledge Check
Review the concept and apply it to a new example.
Which statement best describes ECMAScript?
Which component executes JavaScript language semantics?
Which facility is supplied by a host rather than core ECMAScript?
What does console.log(6 * 7) display?
A browser example uses document. What should you check before running it in Node.js?