vanilla JavaScript
Vanilla JavaScript is plain JavaScript written without a framework or third-party library, using only the language itself and the APIs its host environment already provides.
The word “vanilla” here means plain and unmodified. No specification defines the term, so its edges are informal. Most developers count the ECMAScript language plus the built-in APIs of the runtime, such as the DOM and fetch() in browsers. Code built on a framework such as React or a library such as jQuery isn’t vanilla, even though it’s also JavaScript.
The label comes up most in front-end code, where teams decide whether a page needs a framework. It’s sometimes applied to Node.js code that installs no npm packages, too.
Many tasks that once needed a library now have vanilla equivalents, because newer ECMAScript editions and web platform APIs added them. Selecting elements, making HTTP requests, and grouping arrays are common examples.
Example
Say an order dashboard loads a utility library only to group its orders by status. The built-in Object.groupBy() static method does the same job in vanilla JavaScript:
> const orders = [
… { id: 1, status: "shipped" },
… { id: 2, status: "pending" },
… { id: 3, status: "shipped" },
… ];
undefined
> Object.groupBy(orders, (order) => order.status)
[Object: null prototype] {
shipped: [ { id: 1, status: 'shipped' }, { id: 3, status: 'shipped' } ],
pending: [ { id: 2, status: 'pending' } ]
}
The grouping comes from the language, so the code runs in current browsers and in Node.js with no install step. Object.groupBy() arrived in ES2024 and is Baseline Widely available.
In the browser, a vanilla click handler talks to the DOM directly. This block needs a page with a #subscribe button, so it doesn’t run in Node.js:
const button = document.querySelector("#subscribe");
button.addEventListener("click", () => {
button.classList.add("is-active");
button.textContent = "Subscribed";
});
The querySelector(), addEventListener(), and classList APIs are part of the DOM that browsers provide on every page, so the handler needs no library to find the button or react to clicks.
Related Resources
Tutorial
How to Become a Front-End Developer: A Roadmap
How to become a front-end developer: a four-stage JavaScript roadmap with honest time estimates, what the job pays, and a free checklist.
For additional information on related topics, take a look at the following resources:
- Saving State in the Browser (Course)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Leodanis Pozo Ramos • Updated Nov. 23, 2026