摘要: person.js module.exports = function(){ this.name = "person"; this.sleep = function(){ console.log("sleep in the night"); } this.eat = function(){ cons 阅读全文
posted @ 2017-05-25 20:27 宝宝少少 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 经典继承 借用构造函数,子类型构造函数内部调用超类型构造函数 function SuperType(){ this.colors = ["red","blue","green"]; } function SubType(){ SuperType.call(this); //继承了SuperType 阅读全文
posted @ 2017-05-25 19:33 宝宝少少 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 原生模块调用 var httpModule = require('http'); //require http 模块 文件模块调用 var test = require('./test.js'); exports 和module.exports 只有exports和module.exports对象暴 阅读全文
posted @ 2017-05-25 17:30 宝宝少少 阅读(114) 评论(0) 推荐(0) 编辑
摘要: node.js hello world /** *Node.js base server */ var http = require('http'); http.createServer(function(req,res){ res.writeHead(200,{'Content-Type','te 阅读全文
posted @ 2017-05-25 17:03 宝宝少少 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 1.下载node.js安装 http://nodejs.org 2.添加环境变量c:\Program Files\nodejs\node.exe 到path环境变量中 3.输入node-v 查看是否安装成功 linux 配置 1.下载node.js for linux 源码安装包 2.解压tar - 阅读全文
posted @ 2017-05-25 16:55 宝宝少少 阅读(97) 评论(0) 推荐(0) 编辑