猿问

这串代码怎么解读,详细的,尤其是return哪里

function callTheRoll() { var persons = ['1', '2', '3', '4', '5']; var blacklist = []; return { callName: function(name) { // if (persons.indexOf(name) > -1) { if (~persons.indexOf(name)) { console.log('this one is here'); } else { console.log('this one is not here'); blacklist.push(name); } }, getBlackList: function() { console.log(blacklist); } } } var myRoll = callTheRoll(); console.log(myRoll.blacklist); // undeifed myRoll.callName('2') myRoll.callName('9') myRoll.getBlackList();
qq_满地祈愿长伴_0
浏览 897回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答