示例:
demo.js
// 定义函数
const f1 = () => {
console.log('hello f1')
}
// 定义函数
const f2 = () => {
console.log('hello f2')
}
// 对象中只包含了键,其中键是函数
const obj = {
f1,
f2
}
obj.f1()
obj.f2()
执行node demo.js
:
示例:
demo.js
// 定义函数
const f1 = () => {
console.log('hello f1')
}
// 定义函数
const f2 = () => {
console.log('hello f2')
}
// 对象中只包含了键,其中键是函数
const obj = {
f1,
f2
}
obj.f1()
obj.f2()
执行node demo.js
: