Home  >  Article  >  Web Front-end  >  js static method and instance method analysis_javascript skills

js static method and instance method analysis_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:05:12829browse
js static method
Copy code The code is as follows:

function foo( ){} // Declare class
foo.method = function(){} // Method body

uses: foo.method()

js instance Method
function foo(){ // Declare class
this.method = function(){ // Method body

}
}
Use: var f = new foo(); f.method();
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn