<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>摩名 &#187; JavaScript</title>
	<atom:link href="http://kingabird.com/index.php/tag/js/feed" rel="self" type="application/rss+xml" />
	<link>http://kingabird.com</link>
	<description>记录这里发生的这些和那些事情。</description>
	<lastBuildDate>Wed, 09 Sep 2009 09:22:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>对于构造函数的理解</title>
		<link>http://kingabird.com/index.php/js/02/25</link>
		<comments>http://kingabird.com/index.php/js/02/25#comments</comments>
		<pubDate>Sun, 15 Feb 2009 16:58:23 +0000</pubDate>
		<dc:creator>kingabird</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[构造函数]]></category>

		<guid isPermaLink="false">http://kingabird.com/?p=25</guid>
		<description><![CDATA[
在JavaScript的帮助手册里查到的解释是这样的：
一种 JScript 函数，具有两个特殊的性质：

由 new 运算符来调用此函数。
通过 this 关键字将新创建对象的地址传递到此函数。

请使用构造函数来初始化新的对象。
在JS权威指南里看的解释是：
New创建了一个新的没有任何属性的对象，然后调用该函数，把新的对象作为this关键字的值传递。设计来和new运算符一起使用的函数叫做构造函数 ( constructor function 或 constructor )。
下面来创建一个构造函数然后使用 new 运算符调用它两次来创建两个新的对象：
function Rectangle ( w , y ){
this.widht = w;
this.height = h;
}
var rect1 = new Rectangle ( 2 , 4 );  // rect1 = { width = 2, heithg = 4 };
var rect2 = new Rectangle ( 8.5 , 11 );   [...]]]></description>
			<content:encoded><![CDATA[<p><!--CSS_START--><!-- @import url(../html-vss/msdnie4a.css); --><!--CSS_END--></p>
<p>在JavaScript的帮助手册里查到的解释是这样的：</p>
<blockquote><p>一种 JScript 函数，具有两个特殊的性质：</p>
<ul type="disc">
<li>由 <strong>new</strong> 运算符来调用此函数。</li>
<li>通过 <strong>this</strong> 关键字将新创建对象的地址传递到此函数。</li>
</ul>
<p>请使用构造函数来初始化新的对象。</p></blockquote>
<p>在JS权威指南里看的解释是：</p>
<blockquote><p>New创建了一个新的没有任何属性的对象，然后调用该函数，把新的对象作为this关键字的值传递。设计来和new运算符一起使用的函数叫做构造函数 ( constructor function 或 constructor )。</p></blockquote>
<p>下面来创建一个构造函数然后使用 new 运算符调用它两次来创建两个新的对象：</p>
<blockquote><p>function Rectangle ( w , y ){</p>
<p>this.widht = w;</p>
<p>this.height = h;</p>
<p>}</p>
<p>var rect1 = new Rectangle ( 2 , 4 );  // rect1 = { width = 2, heithg = 4 };</p>
<p>var rect2 = new Rectangle ( 8.5 , 11 );   // rect1 = { width = 8.4, heithg = 11 };</p></blockquote>
<p>this 语句，来源 JavaScript 的帮助手册</p>
<blockquote><p>this 语句<!--CSS_START-->@import url(../html-vss/msdnie4a.css);<!--CSS_END--><span style="color: #000000;">指当前对象。 </span></p>
<p><span style="color: #000000;"><code><strong>this</strong>.property</code></span></p>
<p><span style="color: #000000;">必选的 property 参数指的是对象的属性。</span></p>
<p><span style="color: #000000;">说明</span></p>
<p><span style="color: #000000;"><strong>this</strong> 关键字通常在对象的 构造函数中使用，用来引用对象。</span></p>
<p><span style="color: #000000;">示例</span></p>
<p>在下面示例中，<strong>this</strong> 指的是新创建的 Car 对象，并给三个属性赋值。</p>
<pre><code>function Car(color, make, model){
  <span class="cfe"><strong>this</strong></span>.color = color;
  <span class="cfe"><strong>this</strong></span>.make = make;
  <span class="cfe"><strong>this</strong></span>.model = model;
}</code></pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://kingabird.com/index.php/js/02/25/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
