我正在尝试将已求值的函数返回给终端。我尝试使用window.onload()
,console.log();
alert();
,但未评估URL并将其发送到终端。
我使用命令phantomjs test.js
运行下面的代码
var webPage = require('webpage');
var page = webPage.create();
function testlink() {
return(["h","t","t","p","s",":","\/","\/","i","b","m",".","c","o","m"]);
}
window.onload = testlink;
console.log(testlink);
alert(testlink);
而不是得到(这就是我想要的)
https://ibm.com
我知道
function testlink() {
return(["h","t","t","p","s",":","\/","\/","i","b","m",".","c","o","m"]);
}
Ps:我正在使用Ubuntu 18.04和phantomjs 2.1.1
尝试执行console.log(testlink())
而不是console.log(testlink)