---
title: "javascript misc"
author: "floydd"
date: "2007-12-22T15:09:00Z"
tags: []
slug: "javascript-misc"
draft: false
lastmod: "2011-12-26T12:03:20Z"
id: 1326386
url: "https://floydd.iteye.com/blog/1326386"
---

function ChatTransport(win){  
this.cc=1

this.test1=function(){  
this.test11()  
}  
this.test11=function(){  
alert(this.cc)  
}  
this.test2=function(){  
test22();  
}  
var test22=function(){  
alert(this.cc)  
}

}

var ct = new ChatTransport();  
ct.test1();  
ct.test2();

js中的私有方法（用var定义的，非this）是取不到公有属性（this定义的属性）的