SOURCE

let _items = Symbol()
class Stack{
    constructor(){
        this[_items] = []
    }
    push(el){
        this[_items].push(el)
    }
    print(){
        console.log(stack)
    }
}
let stack = new Stack()
stack.push(5)
stack.push(8)
let objectSymbols = Object.getOwnPropertySymbols(stack)
console.log(objectSymbols.length)
console.log(objectSymbols)
console.log(objectSymbols[0])
stack[objectSymbols[0]].push(1)
stack.print()
console 命令行工具 X clear

                    
>
console