Skip to content
Novus Examples
js113 B

JavaScript — Hello World

The classic hello-world in modern JavaScript — a minimal function calling console.log, for testing highlighters, Node, and JS parsers.

Preview — first 7 linesjs
// The classic first program, in modern JavaScript.
function main() {
  console.log("Hello, world!");
}

main();

Specifications

Language
JavaScript
Kind
hello-world
Lines
6
Encoding
UTF-8
Line Endings
LF

What is a .js file?

JavaScript (.js) is a plain-text source file for the JavaScript language — the scripting language of the web, also used server-side via Node.js. It is dynamically typed and event-driven, with first-class functions, prototypes, and (in modern syntax) modules, classes, and async/await.

How to use this file

Use an example .js file to test syntax highlighters, linters (ESLint), formatters (Prettier), bundlers, and JavaScript parsers, or as editor and diff-viewer fixtures.

Generated by generation/code_samples.py. Free for any use, no attribution required — license.