最赞回答 / 慕粉3294123
首先像楼上说的,call的作用对象应该是函数function pet(words) { //这里应该加参数,否则new Dog('wangwagn')传的参数 就没有意义 this.words = words, this.speak=function(say) { console.log(say + ' ' + this.words); }};function Dog(words) { pet.call(this, words);}var dog = new ...
2016-04-21
已采纳回答 / 慕UI3015154
我也是新手,刚刚接触到Node,我把我自己安装成功的方法告诉你吧。就是你先确定自己安装node.js的时候有没有安装express,还有就是修改环境变量。我是把这两个都弄好后就安装cheerio成功了。希望可以帮到你,我们一起进步吧~!
2016-04-20
最新回答 / microzz
//适合现在慕课网的代码,水平有限,有不足希望指点var http = require('http')var cheerio = require('cheerio')var url = 'http://www.imooc.com/learn/348/'function filterChapters(html){ var $ =cheerio.load(html) var chapters = $('.chapter') var courseData=[] chapters.each...
2016-04-20
最新回答 / 洛央下
const http = require('http');const hostname = '127.0.0.1';const port = 3000;const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World\n');})server.listen(port, hostname, ...
2016-04-19