function comment() {
// This is a one line JavaScript comment
console.log("Hello world!");
}
comment();Lexical grammar / notebook
Lexical grammar
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
function comment() {
/* This is a one line JavaScript comment */
console.log("Hello world!");
}
comment();function comment() {
/* This comment spans multiple lines. Notice
that we don't need to end the comment until we're done. */
console.log("Hello world!");
}
comment();function comment(x) {
console.log("Hello " + x /* insert the value of x */ + " !");
}
comment("world");function comment() {
/* console.log("Hello world!"); */
}
comment();#!/usr/bin/env node
console.log("Hello world");const decl = 1; // Variable declaration (may also be `let` or `var`)
function fn() {} // Function declaration
const obj = { key: "value" }; // Object keys
// Class declaration
class C {
#priv = "value"; // Private field
}
lbl: console.log(1); // Label