Hello World
·
更新于 · 1min
const compose =
(...fns) =>
(x) =>
fns.reduceRight((v, f) => f(v), x)
const formatMessage = (target) => `Hello, ${target}! 🚀`
const genStyle = () =>
[
'color: #fff',
'background: linear-gradient(45deg, #ff00cc, #3333ff)',
'padding: 5px 10px',
'border-radius: 4px',
'font-weight: bold'
].join(';')
const printStyled = (message) => console.log(`%c${message}`, genStyle())
const greet = compose(printStyled, formatMessage)
greet('World')node hello.js
Hello, World! 🚀