JS: Interface

By Xah Lee. Date: . Last updated: .

(new in JS: ECMAScript 2015)

What is JavaScript interface

An interface is a spec for a set of property keys and values .

When a object confoms to interface X, we say that the object is “X object”. e.g. a object that conforms to the iterable interface is called “iterable object”.

There are 3 interfaces defined by the JavaScript spec:

Purpose of JavaScript Interface

JavaScript interface is the underlying mechanism for how Iterable Object works.

JavaScript. Iterable, Iterator