Pipeline operator - JavaScript | MDN Skip to main content Select language Skip to search MDN Web Docs Technologies HTML CSS JavaScript Graphics HTTP APIs / DOM Browser Extensions MathML References & Guides Learn web development Tutorials References Developer Guides Accessibility Game development ...more docs Feedback Get Firefox help Get web development help Join the MDN community Report a content problem Report a bug Sign in Github Search Search Close search Pipeline operator Languages Deutsch (de) Français (fr) æ¥æ¬èª (ja) íêµì´ (ko) Polski (pl) Português (do Brasil) (pt-BR) Ð ÑÑÑкий (ru) ä¸æ (ç®ä½) (zh-CN) Add a translation Edit Advanced Advanced History Print this article Jump to: Syntax Examples Specifications Browser compatibility See also This is an experimental technology Check the Browser compatibility table carefully before using this in production. The experimental pipeline operator |> (currently at stage 1) pipes the value of an expression into a function. This allows the creation of chained function calls in a readable manner. The result is syntactic sugar in which a function call with a single argument can be written like this: The equivalent call in traditional syntax looks like this: Syntax expression |> function
The value of the specified expression is passed into the function as its sole parameter. Examples Chaining function calls The pipeline operator can improve readability when chaining several functions. Specifications Specification Status Comment Pipeline operator draft Stage 1 Not part of the ECMAScript specification yet. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. Update compatibility data on GitHub Desktop Mobile Server Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js Pipeline operator (|>) Experimental Chrome No support No Edge No support No Firefox No support No IE No support No Opera No support No Safari No support No WebView Android No support No Chrome Android No support No Firefox Android No support No Opera Android No support No Safari iOS No support No Samsung Internet Android No support No nodejs No support No Legend No support  No support Experimental. Expect behavior to change in the future. Experimental. Expect behavior to change in the future. See also Github - Proposal-pipeline-operator TC39 proposals Document Tags and Contributors Tags: Chaining Experimental JavaScript Operator Pipeline Contributors to this page: Himself65, mdnwebdocs-bot, Sheppy, sideshowbarker, charnz, cbalisky, DingoEatingFuzz, qwertypants, fscholz Last updated by: Himself65, Mar 22, 2019, 9:19:23 AM Web technology for developers JavaScript JavaScript reference Expressions and operators Pipeline operator Related Topics JavaScript Tutorials: Complete beginners JavaScript basics JavaScript first steps JavaScript building blocks Introducing JavaScript objects JavaScript Guide Introduction Grammar and types Control flow and error handling Loops and iteration Functions Expressions and operators Numbers and dates Text formatting Regular expressions Indexed collections Keyed collections Working with objects Details of the object model Using promises Iterators and generators Meta programming JavaScript modules Intermediate Introducing JavaScript objects Client-side web APIs A re-introduction to JavaScript JavaScript data structures Equality comparisons and sameness Closures Advanced Inheritance and the prototype chain Strict mode JavaScript typed arrays Memory Management Concurrency model and Event Loop References: Built-in objects Array ArrayBuffer AsyncFunction Atomics BigInt BigInt64Array BigUint64Array Boolean DataView Date Error EvalError Float32Array Float64Array Function Generator GeneratorFunction Infinity Int16Array Int32Array Int8Array InternalError Intl Intl.Collator Intl.DateTimeFormat Intl.ListFormat Intl.Locale Intl.NumberFormat Intl.PluralRules Intl.RelativeTimeFormat JSON Map Math NaN Number Object Promise Proxy RangeError ReferenceError Reflect RegExp Set SharedArrayBuffer String Symbol SyntaxError TypeError TypedArray URIError Uint16Array Uint32Array Uint8Array Uint8ClampedArray WeakMap WeakSet WebAssembly decodeURI() decodeURIComponent() encodeURI() encodeURIComponent() escape() eval() globalThis isFinite() isNaN() null parseFloat() parseInt() undefined unescape() uneval() Expressions & operators Arithmetic operators Array comprehensions Assignment operators Bitwise operators Comma operator Comparison operators Conditional (ternary) operator Destructuring assignment Expression closures Generator comprehensions Grouping operator Legacy generator function expression Logical operators Object initializer Operator precedence Pipeline operator Property accessors Spread syntax async function expression await class expression delete operator function expression function* expression in operator instanceof new operator new.target super this typeof void operator yield yield* Statements & declarations Legacy generator function async function block break class const continue debugger default do...while empty export for for await...of for each...in for...in for...of function declaration function* if...else import import.meta label let return switch throw try...catch var while with Functions Arrow functions Default parameters Method definitions Rest parameters The arguments object getter setter Classes constructor extends static Errors Error: Permission denied to access property "x" InternalError: too much recursion RangeError: argument is not a valid code point RangeError: invalid array length RangeError: invalid date RangeError: precision is out of range RangeError: radix must be an integer RangeError: repeat count must be less than infinity RangeError: repeat count must be non-negative ReferenceError: "x" is not defined ReferenceError: assignment to undeclared variable "x" ReferenceError: can't access lexical declaration`X' before initialization ReferenceError: deprecated caller or arguments usage ReferenceError: invalid assignment left-hand side ReferenceError: reference to undefined property "x" SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated SyntaxError: "use strict" not allowed in function with non-simple parameters SyntaxError: "x" is a reserved identifier SyntaxError: JSON.parse: bad parsing SyntaxError: Malformed formal parameter SyntaxError: Unexpected token SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead SyntaxError: a declaration in the head of a for-of loop can't have an initializer SyntaxError: applying the 'delete' operator to an unqualified name is deprecated SyntaxError: for-in loop head declarations may not have initializers SyntaxError: function statement requires a name SyntaxError: identifier starts immediately after numeric literal SyntaxError: illegal character SyntaxError: invalid regular expression flag "x" SyntaxError: missing ) after argument list SyntaxError: missing ) after condition SyntaxError: missing : after property id SyntaxError: missing ; before statement SyntaxError: missing = in const declaration SyntaxError: missing ] after element list SyntaxError: missing formal parameter SyntaxError: missing name after . operator SyntaxError: missing variable name SyntaxError: missing } after function body SyntaxError: missing } after property list SyntaxError: redeclaration of formal parameter "x" SyntaxError: return not in function SyntaxError: test for equality (==) mistyped as assignment (=)? SyntaxError: unterminated string literal TypeError: "x" has no properties TypeError: "x" is (not) "y" TypeError: "x" is not a constructor TypeError: "x" is not a function TypeError: "x" is not a non-null object TypeError: "x" is read-only TypeError: 'x' is not iterable TypeError: More arguments needed TypeError: Reduce of empty array with no initial value TypeError: can't access dead object TypeError: can't access property "x" of "y" TypeError: can't assign to property "x" on "y": not an object TypeError: can't define property "x": "obj" is not extensible TypeError: can't delete non-configurable array element TypeError: can't redefine non-configurable property "x" TypeError: cannot use 'in' operator to search for 'x' in 'y' TypeError: cyclic object value TypeError: invalid 'instanceof' operand 'x' TypeError: invalid Array.prototype.sort argument TypeError: invalid arguments TypeError: invalid assignment to const "x" TypeError: property "x" is non-configurable and can't be deleted TypeError: setting getter-only property "x" TypeError: variable "x" redeclares argument URIError: malformed URI sequence Warning: -file- is being assigned a //# sourceMappingURL, but already has one Warning: 08/09 is not a legal ECMA-262 octal constant Warning: Date.prototype.toLocaleFormat is deprecated Warning: JavaScript 1.6's for-each-in loops are deprecated Warning: String.x is deprecated; use String.prototype.x instead Warning: expression closures are deprecated Warning: unreachable code after return statement X.prototype.y called on incompatible type Misc JavaScript technologies overview Lexical grammar JavaScript data structures Enumerability and ownership of properties Iteration protocols Strict mode Transitioning to strict mode Template literals Deprecated features New in JavaScript ECMAScript 2015 support in Mozilla ECMAScript 5 support in Mozilla Firefox JavaScript changelog New in JavaScript 1.1 New in JavaScript 1.2 New in JavaScript 1.3 New in JavaScript 1.4 New in JavaScript 1.5 New in JavaScript 1.6 New in JavaScript 1.7 New in JavaScript 1.8 New in JavaScript 1.8.1 New in JavaScript 1.8.5 Documentation: Useful lists All pages index Methods index Properties index Pages tagged "JavaScript" Contribute JavaScript doc status The MDN project Learn the best of web development Get the latest and greatest from MDN delivered straight to your inbox. E-mail I'm okay with Mozilla handling my info as explained in this Privacy Policy. Sign up now Thanks! Please check your inbox to confirm your subscription. If you havenât previously confirmed a subscription to a Mozilla-related newsletter you may have to do so. Please check your inbox or your spam filter for an email from us. Hide Newsletter Sign-up MDN Survey Help us understand the top 10 needs of Web developers and designers. Take the survey Minimize
banner Close
banner MDN Web Docs MDN Web Technologies Learn Web Development About MDN Feedback Twitter GitHub Mozilla Mozilla About Contact Us Firefox Twitter Instagram Other languages: English (US) (en-US) Deutsch (de) Français (fr) æ¥æ¬èª (ja) íêµì´ (ko) Polski (pl) Português (do Brasil) (pt-BR) Ð ÑÑÑкий (ru) ä¸æ (ç®ä½) (zh-CN) Go Terms Privacy Cookies © 2005-2019 Mozilla and individual contributors. Content is available under these licenses.