方法 js的数组提供了push()和pop()方法,直接使用数组即可 var stack = [] stack.push(1) stack.push(2) console.log(stack.pop()