HTML CSS JavaScript SEO Python Posts Privacy About Contact

JS Syntax

JavaScript syntax is the set of rules defining how JavaScript programs are written.

JavaScript syntax defines the rules for writing valid programs. The three core building blocks are literals (fixed values), variables (named storage), and expressions (computed values).

Try It — Syntax Building Blocks

Preview

Syntax Quick Reference

ConceptExample
Number literal42, 3.14
String literal"Hello", 'World'
Boolean literaltrue, false
let variablelet name = "Alice";
const constantconst PI = 3.14;
Expressionwidth * height
Comment// this is a comment

Tip: Use const for values that won’t change (most things). Use let when the value will be reassigned. Avoid var in modern JavaScript.