javascript笔记(五)

私有成员

 <script type="text/javascript">
  <!--
	function CurrentAnswer(num)
	{
	     var current=num;
		 var newObject={
		      getCurrent:function(){return 'The current answer is :'+current;}
		 }
		 return newObject
	}
	var curr=new CurrentAnswer('5');
	alert(curr.getCurrent());

  //-->
  </script>

posted on 2012-04-23 09:02  逍遥叹  阅读(125)  评论(0编辑  收藏  举报