fe icon indicating copy to clipboard operation
fe copied to clipboard

现代编程语言最有趣的 10 大特性

Open justjavac opened this issue 8 years ago • 1 comments

文章现代编程语言最有趣的 10 大特性

音频:无

视频:无


原文Ten interesting features from various modern languages

justjavac avatar Nov 14 '17 07:11 justjavac

对于 2 模式匹配 Pattern matching 有一个 js 库:

  • https://github.com/z-pattern-matching/z

代码示例:

const { matches } = require('z')

const result = matches(1)(
  (x = 2)      => 'number 2 is the best!!!',
  (x = Number) => `number ${x} is not that good`,
  (x = Date)   => 'blaa.. dates are awful!'
)

console.log(result) // output: number 1 is not that good

justjavac avatar Nov 27 '17 01:11 justjavac