当前位置 博文首页 > cuk0051的博客:JavaScript中的命名空间
What is namespacing?
什么是命名空间?
Namespacing is the act of wrapping a set of entities, variables, functions, objects under a single umbrella term.
名称间隔是在单个总括术语下包装一组实体,变量,函数,对象的行为。
JavaScript has various ways to do that, and seeing the examples will make the concept easier to understand.
JavaScript有多种实现方法,查看示例将使概念更易于理解。
The simplest way to create a namespace is by creating an object literal:
创建名称空间的最简单方法是创建对象文字:
const car = {
start: () => {
console.log('start')
},
stop: () => {
console.log('stop')
}
}
cs