新手初学,一直不明白set的参数是哪里来的,比如var ex={$n:0,get next(){return this.$n++;},set next(n){if(n>=this.$n) this.$n=n;else throw"错误";}};set next(n)的n是什么?求大神解答
内部机制,当你执行 ex.n = 3 时,就调用setter方法,参数n就是3