Explorar o código

Docsify Auto Published

Willin Wang %!s(int64=7) %!d(string=hai) anos
pai
achega
1b7af98ef8
Modificáronse 1 ficheiros con 21 adicións e 0 borrados
  1. 21 0
      basic/js/es.md

+ 21 - 0
basic/js/es.md

@@ -1,5 +1,26 @@
 # ES Next
 
+## Pipeline Operator (Proposal)
+
+目前处于草稿阶段: <https://github.com/tc39/proposal-pipeline-operator>
+
+```js
+function doubleSay(str) {
+  return `${str}, ${str}`;
+}
+function capitalize(str) {
+  return str[0].toUpperCase() + str.substring(1);
+}
+function exclaim(str) {
+  return `${str}!`;
+}
+
+let result = "hello" |> doubleSay |> capitalize |> exclaim;
+
+result |> console.log;
+//=> "Hello, hello!"
+```
+
 ## Async (ES 7)
 
 ```js