---
title: "js归纳"
author: "hn2002"
date: "2009-09-17T16:21:56Z"
tags: []
slug: "js"
draft: false
lastmod: "2009-09-17T16:21:56Z"
id: 470512
url: "https://hn2002.iteye.com/blog/470512"
---

1 几种javascript函数定义的区别

http://blog.csdn.net/mallva/archive/2007/12/18/1947223.aspx

 

2  
函数本来也是种对象，如下为定义类型名为people的对象：  
1 有参的构造方法  
function people(name){  
this.name=name;  
}

2 给对象添加一个属性（方法）  
people.prototype.getName = function() {  
return this.name;  
}

使用：  
1 实例化一个对象  
var me=new people('chenxiaowen');  
2 调用事例的方法me.getName()  
alert(me.getName());