Standard built-ins

Symbol.match

Try the free JavaScript compiler

Key for a custom match operation consulted by String.prototype.match; also involved in RegExp recognition.

Formal Syntax & Structure

javascript syntaxjavascript
Symbol.match

Return Value

symbol

The predefined protocol key.

Working Example

Example Snippetjavascript
const x={[Symbol.match](s){return [s.length];}};console.log(JSON.stringify("ab".match(x)));
JavaScript Reference