// 定义类class Stack{// #items= [] 前边加#变为私有 外部不能随意修改 内部使用也要加#items = []pop(){return this.items.pop()}push(data){this.items.push(data)}peek(){return this.items[this.items.length-1]}isEmpty(){return this.items.length === 0}size(){return this.items.length}}// let stack = new Stack()// 应用栈结构function jz(decNumber,base) {let remStack = new Stack()let number = decNumberlet string = ""// 考虑十六进制let baseString = "0123456789ABCDEF"// 取余存入while(number >0){remStack.push(number%base)number = Math.floor(number/base)}// 取商输出while(!(remStack.isEmpty())){string += baseString[remStack.pop()]}return string}jz(50,8)