Node. js learning and application

Source: Internet
Author: User

Learning Materials

Entry:

Http://samsungapps.csdn.net/text.html? Arcid = 1, 311044

After learning about npm, install the dependent modules in the default lib directory of node. js, similar to python's easy_install (in fact, most of them are copy)

Advanced:

Advanced Article http://archive.cnblogs.com/a/2127237/

Reading the node beginner book will give you a rough idea of passing the function parameters of the event model.

In-depth:

Http://www.cnblogs.com/phphuaibei/archive/2011/09/03/2165437.html

Eclipse js plug-in

: Http://download.macromedia.com/pub/labs/jseclipse/autoinstall

Use prototype of js:

A common method (I am surprised to see it ):

var Closure = function(){}
Closure.prototype={
hello:function(){
console.log("hello world")
}
}
c = new Closure()
c.hello()

All objects can have prototypes, and prototypes can also have prototypes. In this way, a prototype chain is formed after a loop,
This chain is terminated when prototype in the formation in the chain is null. (The default prototype of the Object is null)

Js closure

var name = "The Window";
var object = {
name : "My Object",
getNameFunc : function(){
var that = this;
return function(){
return that.name;
};
}
};
alert(object.getNameFunc()())
); //”My Object”

By default, this indicates that windows uses the Global name. You need to use the attribute name of the current object in the closure.

Js tips:

  1. The difference between variables defined by var and those without var: The global variables and local variables cannot be clearly identified, and the var declaration is applied to local variables. It is best to declare all variables with var.
  2. The closure brings out the scope containing the function, which will occupy more memory and should not be used as little as possible.
  3. The setTimeout and setInterval syntaxes are the same. They all have two parameters: one is the code string to be executed, and the other is the interval in milliseconds. after that period, the code will be executed. However, there are differences between the two functions. After the setInterval code is executed, it automatically repeats the code after the fixed interval, setTimeout only executes the code once.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.