我想知道为什么我的未定义如果我这样声明:
var mainBtn = $('.main-button'),
cloneFund = (function(mainBtn) {
console.log(mainBtn); // undefined
return arguments.callee;
})();
甚至:
var btn = $('.main-button'),
cloneFund = (function(btn) {
console.log(btn); // undefined
return arguments.callee;
})();
答案 0 :(得分:1)
你必须将mainBtn传递给函数。
describe('Protractor Demo App', function() {
browser.get('http://example.com');//url
it("Test..", function() {
element(by.model('customer.firstName')).sendKeys('FIRSTNAME');
element(by.model('customer.lastName')).sendKeys('LASTNAME');
});
});
var mainBtn = $('.main-button'),
cloneFund = (function(mainBtn) {
console.log(mainBtn); // available
return arguments.callee;
})(mainBtn); // here you have to pass
答案 1 :(得分:1)
你应该:
var btn = $('.main-button'),
cloneFund = (function(btn) {
console.log(btn); // undefined
return arguments.callee;
})(btn); // need to add the argument when invoked