<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>JAVA SCRIPT</title>
	<atom:link href="http://jvscript01.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jvscript01.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 02 Mar 2009 09:56:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jvscript01.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>JAVA SCRIPT</title>
		<link>http://jvscript01.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jvscript01.wordpress.com/osd.xml" title="JAVA SCRIPT" />
	<atom:link rel='hub' href='http://jvscript01.wordpress.com/?pushpress=hub'/>
		<item>
		<title></title>
		<link>http://jvscript01.wordpress.com/2009/03/02/7/</link>
		<comments>http://jvscript01.wordpress.com/2009/03/02/7/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 09:53:19 +0000</pubDate>
		<dc:creator>apryll25</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jvscript01.wordpress.com/?p=7</guid>
		<description><![CDATA[JavaScript JavaScript is a scripting language widely used for client-side web development. It was the originating dialect of the ECMAScript standard. It is a dynamic, weakly typed, prototype-based language with first-class functions. JavaScript was influenced by many languages and was designed to look like Java, but be easier for non-programmers to work with.[1][2] Although best [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jvscript01.wordpress.com&amp;blog=6793011&amp;post=7&amp;subd=jvscript01&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1 class="firstHeading">JavaScript</h1>
<p><strong>JavaScript</strong> is a <a title="Scripting language" href="http://en.wikipedia.org/wiki/Scripting_language">scripting language</a> widely used for <a title="Client-side" href="http://en.wikipedia.org/wiki/Client-side">client-side</a> web development. It was the originating <a class="mw-redirect" title="Programming language dialect" href="http://en.wikipedia.org/wiki/Programming_language_dialect">dialect</a> of the <a title="ECMAScript" href="http://en.wikipedia.org/wiki/ECMAScript">ECMAScript</a> standard. It is a <a class="mw-redirect" title="Dynamic language" href="http://en.wikipedia.org/wiki/Dynamic_language">dynamic</a>, <a title="Weak typing" href="http://en.wikipedia.org/wiki/Weak_typing">weakly typed</a>, <a title="Prototype-based programming" href="http://en.wikipedia.org/wiki/Prototype-based_programming">prototype-based</a> language with <a title="First-class function" href="http://en.wikipedia.org/wiki/First-class_function">first-class functions</a>. JavaScript was influenced by many languages and was designed to look like <a title="Java (programming language)" href="http://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a>, but be easier for non-programmers to work with.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-techvision-0"><span>[</span>1<span>]</span></a></sup><sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-popularity-1"><span>[</span>2<span>]</span></a></sup></p>
<p>Although best known for its use in <a title="Website" href="http://en.wikipedia.org/wiki/Website">websites</a> (as <a title="Client-side JavaScript" href="http://en.wikipedia.org/wiki/Client-side_JavaScript">client-side JavaScript</a>), JavaScript is also used to enable scripting access to objects embedded in other applications .</p>
<p>JavaScript, despite the name, is essentially unrelated to the Java programming language, although both have the common <a title="C (programming language)" href="http://en.wikipedia.org/wiki/C_%28programming_language%29">C</a> <a title="Curly bracket programming language" href="http://en.wikipedia.org/wiki/Curly_bracket_programming_language">syntax</a>, and JavaScript copies many Java names and naming conventions. The language&#8217;s name is the result of a co-marketing deal between <a title="Netscape" href="http://en.wikipedia.org/wiki/Netscape">Netscape</a> and <a title="Sun Microsystems" href="http://en.wikipedia.org/wiki/Sun_Microsystems">Sun</a>, in exchange for Netscape bundling Sun&#8217;s Java runtime with their then-dominant <a title="Web browser" href="http://en.wikipedia.org/wiki/Web_browser">browser</a>. The key design principles within JavaScript are inherited from the <a title="Self (programming language)" href="http://en.wikipedia.org/wiki/Self_%28programming_language%29">Self</a> and <a title="Scheme (programming language)" href="http://en.wikipedia.org/wiki/Scheme_%28programming_language%29">Scheme</a> programming languages.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-2"><span>[</span>3<span>]</span></a></sup></p>
<p>&#8220;JavaScript&#8221; is a <a title="Trademark" href="http://en.wikipedia.org/wiki/Trademark">trademark</a> of Sun Microsystems. It was used under license for technology invented and implemented by Netscape Communications and current entities such as the <a title="Mozilla Foundation" href="http://en.wikipedia.org/wiki/Mozilla_Foundation">Mozilla Foundation</a>.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-3"><span>[</span>4<span>]</span></a></sup></p>
<table id="toc" class="toc" border="0" summary="Contents">
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
<h2><span class="mw-headline">History and naming</span></h2>
<p>JavaScript was originally developed by <a title="Brendan Eich" href="http://en.wikipedia.org/wiki/Brendan_Eich">Brendan Eich</a> of Netscape under the name <em>Mocha</em>, which was later renamed to <em>LiveScript</em>, and finally to JavaScript.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-4"><span>[</span>5<span>]</span></a></sup> The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its <a title="Netscape Navigator" href="http://en.wikipedia.org/wiki/Netscape_Navigator">Netscape Navigator</a> <a title="Web browser" href="http://en.wikipedia.org/wiki/Web_browser">web browser</a>. JavaScript was first introduced and deployed in the Netscape browser version 2.0B3 in December 1995. The naming has caused confusion, giving the impression that the language is a spin-off of Java, and it has been characterized by many as a marketing ploy by Netscape to give JavaScript the cachet of what was then the hot new web-programming language.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-5"></a></sup><sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-6"></a></sup></p>
<p>Due to the widespread success of JavaScript as a client-side scripting language for web pages, <a title="Microsoft" href="http://en.wikipedia.org/wiki/Microsoft">Microsoft</a> developed a compatible dialect of the language, naming it <a title="JScript" href="http://en.wikipedia.org/wiki/JScript">JScript</a> to avoid trademark issues. JScript added new date methods to fix the non-<a title="Year 2000 problem" href="http://en.wikipedia.org/wiki/Year_2000_problem">Y2K</a>-friendly methods in JavaScript, which were based on <a class="external text" title="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html" rel="nofollow" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html">java.util.Date</a>.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-popularity-1"><span>[</span>2<span>]</span></a></sup> JScript was included in <a title="Internet Explorer" href="http://en.wikipedia.org/wiki/Internet_Explorer">Internet Explorer</a> 3.0, released in August 1996. The dialects are perceived to be so similar that the terms &#8220;JavaScript&#8221; and &#8220;JScript&#8221; are often used interchangeably. Microsoft, however, notes dozens of ways in which JScript is <a class="external text" title="http://msdn2.microsoft.com/en-us/library/4tc5a343.aspx" rel="nofollow" href="http://msdn2.microsoft.com/en-us/library/4tc5a343.aspx">not ECMA compliant</a>.</p>
<p>Netscape submitted JavaScript to <a title="Ecma International" href="http://en.wikipedia.org/wiki/Ecma_International">Ecma International</a> for standardization resulting in the standardized version named <a title="ECMAScript" href="http://en.wikipedia.org/wiki/ECMAScript">ECMAScript</a>.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-7"></a></sup></p>
<p>The flexibility of JavaScript has made it one of the most popular programming languages on the web and also one of the easier languages to learn. Initially, however, many professional programmers denigrated the language because its target audience was web authors and other such &#8220;amateurs&#8221;, among other reasons.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-8"><span>[</span>9<span>]</span></a></sup> The advent of <a title="Ajax (programming)" href="http://en.wikipedia.org/wiki/Ajax_%28programming%29">AJAX</a> returned JavaScript to the spotlight and brought more professional programming attention. The result was a proliferation of comprehensive frameworks and libraries, improved JavaScript programming practices, and increased usage of JavaScript outside of the web.<sup class="noprint Template-Fact"><span style="white-space:nowrap;" title="This claim needs references to reliable sources since February 2009"><em><a title="Wikipedia:Citation needed" href="http://en.wikipedia.org/wiki/Wikipedia:Citation_needed"><br />
</a></em></span></sup></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jvscript01.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jvscript01.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jvscript01.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jvscript01.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jvscript01.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jvscript01.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jvscript01.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jvscript01.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jvscript01.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jvscript01.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jvscript01.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jvscript01.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jvscript01.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jvscript01.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jvscript01.wordpress.com&amp;blog=6793011&amp;post=7&amp;subd=jvscript01&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jvscript01.wordpress.com/2009/03/02/7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8d54daea0b56a41e58a238ba63def5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">apryll25</media:title>
		</media:content>
	</item>
		<item>
		<title>FEATURES</title>
		<link>http://jvscript01.wordpress.com/2009/03/02/features/</link>
		<comments>http://jvscript01.wordpress.com/2009/03/02/features/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 09:52:05 +0000</pubDate>
		<dc:creator>apryll25</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jvscript01.wordpress.com/?p=6</guid>
		<description><![CDATA[Imperative and structured JavaScript supports all the structured programming syntax in C (e.g., if statements, while loops, switch statements, etc.). One partial exception is scoping: C-style block-level scoping is not supported. JavaScript 1.7, however, supports block-level scoping with the let keyword. Like C, JavaScript makes a distinction between expressions and statements. Dynamic dynamic typing As [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jvscript01.wordpress.com&amp;blog=6793011&amp;post=6&amp;subd=jvscript01&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3><span class="mw-headline">Imperative and structured</span></h3>
<p>JavaScript supports all the <a title="Structured programming" href="http://en.wikipedia.org/wiki/Structured_programming">structured programming</a> syntax in <a class="mw-redirect" title="C (computer language)" href="http://en.wikipedia.org/wiki/C_%28computer_language%29">C</a> (e.g., <code>if</code> statements, <code>while</code> loops, <code>switch</code> statements, etc.). One partial exception is <a class="mw-redirect" title="Scope (computer science)" href="http://en.wikipedia.org/wiki/Scope_%28computer_science%29">scoping</a>: C-style block-level scoping is not supported. JavaScript 1.7, however, supports block-level scoping with the <code>let</code> keyword. Like C, JavaScript makes a distinction between <a title="Expression (programming)" href="http://en.wikipedia.org/wiki/Expression_%28programming%29">expressions</a> and <a title="Statement (programming)" href="http://en.wikipedia.org/wiki/Statement_%28programming%29">statements</a>.</p>
<p><a id="Dynamic" name="Dynamic"></a></p>
<h3><span class="mw-headline">Dynamic</span></h3>
<dl>
<dt>dynamic typing</dt>
<dd>As in most scripting languages, <a title="Type system" href="http://en.wikipedia.org/wiki/Type_system">types</a> are associated with <a title="Value (computer science)" href="http://en.wikipedia.org/wiki/Value_%28computer_science%29">values</a>, not <a class="mw-redirect" title="Variables" href="http://en.wikipedia.org/wiki/Variables">variables</a>. For example, a variable <code>x</code> could be bound to a number, then later rebound to a <a title="String (computer science)" href="http://en.wikipedia.org/wiki/String_%28computer_science%29">string</a>. JavaScript supports various ways to test the type of an object, including <a title="Duck typing" href="http://en.wikipedia.org/wiki/Duck_typing">duck typing</a>.<sup class="reference"><a href="http://en.wikipedia.org/wiki/JavaScript#cite_note-9"><span>[</span>10<span>]</span></a></sup></dd>
<dt>objects as associative arrays</dt>
<dd>JavaScript is almost entirely <a title="Object-based" href="http://en.wikipedia.org/wiki/Object-based">object-based</a>. <a title="Object (computer science)" href="http://en.wikipedia.org/wiki/Object_%28computer_science%29">Objects</a> are <a title="Associative array" href="http://en.wikipedia.org/wiki/Associative_array">associative arrays</a>, augmented with prototypes (see below). Object property names are associative array keys: <code>obj.x = 10</code> and <code>obj["x"] = 10</code> are equivalent, the dot notation being merely <a title="Syntactic sugar" href="http://en.wikipedia.org/wiki/Syntactic_sugar">syntactic sugar</a>. Properties and their values can be added, changed, or deleted at run-time. The properties of an object can also be enumerated via a <code>for...in</code> loop.</dd>
<dt>run-time evaluation</dt>
<dd>JavaScript includes an <a title="Eval" href="http://en.wikipedia.org/wiki/Eval">eval</a> function that can execute statements provided as strings at run-time.</dd>
</dl>
<p><a id="Functional" name="Functional"></a></p>
<h3><span class="mw-headline">Functional</span></h3>
<dl>
<dt>first-class functions</dt>
<dd><a title="Subroutine" href="http://en.wikipedia.org/wiki/Subroutine">Functions</a> are <a title="First-class function" href="http://en.wikipedia.org/wiki/First-class_function">first-class</a>; they are objects themselves. As such, they have properties and can be passed around and interacted with like any other object.</dd>
<dt>inner functions and closures</dt>
<dd>Inner functions (functions defined within other functions) are created each time the outer function is invoked, and variables of the outer functions for that invocation continue to exist as long as the inner functions still exist, even after that invocation is finished (e.g. if the inner function was returned, it still has access to the outer function&#8217;s variables) — this is the mechanism behind <a title="Closure (computer science)" href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29">closures</a> within JavaScript.</dd>
</dl>
<p><a id="Prototype-based" name="Prototype-based"></a></p>
<h3><span class="mw-headline">Prototype-based</span></h3>
<dl>
<dt>prototypes</dt>
<dd>JavaScript uses <a title="Prototype-based programming" href="http://en.wikipedia.org/wiki/Prototype-based_programming">prototypes</a> instead of <a title="Class (computer science)" href="http://en.wikipedia.org/wiki/Class_%28computer_science%29">classes</a> for defining object properties, including <a title="Method (computer science)" href="http://en.wikipedia.org/wiki/Method_%28computer_science%29">methods</a>, and <a title="Inheritance (computer science)" href="http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29">inheritance</a>. It is possible to simulate many class-based features with prototypes in JavaScript.</dd>
<dt>functions as object constructors</dt>
<dd>Functions double as object constructors along with their typical role. Prefixing a function call with <code>new</code> creates a new object and calls that function with its local <code>this</code> keyword bound to that object for that invocation. The function&#8217;s <code>prototype</code> property determines the new object&#8217;s prototype.</dd>
<dt>functions as methods</dt>
<dd>Unlike many object-oriented languages, there is no distinction between a function definition and a <a title="Method (computer science)" href="http://en.wikipedia.org/wiki/Method_%28computer_science%29">method</a> definition. Rather, the distinction occurs during function calling; a function can be called as a method. When a function is invoked as a method of an object, the function&#8217;s local <code>this</code> keyword is bound to that object for that invocation.</dd>
</dl>
<p><a id="Miscellaneous" name="Miscellaneous"></a></p>
<h3><span class="mw-headline">Miscellaneous</span></h3>
<dl>
<dt>run-time environment</dt>
<dd>JavaScript typically relies on a run-time environment (e.g. in a web browser) to provide objects and methods by which scripts can interact with &#8220;the outside world&#8221;. (This is not a language feature per se, but it is common in most JavaScript implementations.)</dd>
<dt>variadic functions</dt>
<dd>An indefinite number of parameters can be passed to a function. The function can both access them through <a class="mw-redirect" title="Formal parameter" href="http://en.wikipedia.org/wiki/Formal_parameter">formal parameters</a> and the local <code>arguments</code> object.</dd>
<dt>array and object literals</dt>
<dd>Like many scripting languages, arrays and objects (associative arrays in other languages) can each be created with a succinct shortcut syntax. In fact, these <a class="mw-redirect" title="Object literal" href="http://en.wikipedia.org/wiki/Object_literal">literals</a> form the basis of the <a title="JSON" href="http://en.wikipedia.org/wiki/JSON">JSON</a> data format.</dd>
<dt>regular expressions</dt>
<dd>JavaScript also supports <a title="Regular expression" href="http://en.wikipedia.org/wiki/Regular_expression">regular expressions</a> in a manner similar to <a title="Perl" href="http://en.wikipedia.org/wiki/Perl">Perl</a>, which provide a concise and powerful syntax for text manipulation that is more sophisticated than the built-in string functions.</dd>
</dl>
<p><a id="Syntax_and_Semantics" name="Syntax_and_Semantics"></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jvscript01.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jvscript01.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jvscript01.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jvscript01.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jvscript01.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jvscript01.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jvscript01.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jvscript01.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jvscript01.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jvscript01.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jvscript01.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jvscript01.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jvscript01.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jvscript01.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jvscript01.wordpress.com&amp;blog=6793011&amp;post=6&amp;subd=jvscript01&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jvscript01.wordpress.com/2009/03/02/features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8d54daea0b56a41e58a238ba63def5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">apryll25</media:title>
		</media:content>
	</item>
		<item>
		<title>JAVA SCRIPT</title>
		<link>http://jvscript01.wordpress.com/2009/03/02/hello-world/</link>
		<comments>http://jvscript01.wordpress.com/2009/03/02/hello-world/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 09:26:29 +0000</pubDate>
		<dc:creator>apryll25</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[SAMPLE CODES function LCMCalculator(x, y) { // constructor function function checkInt(x) { // inner function if (x % 1 != 0) throw new TypeError(x + &#8221; is not an integer&#8221;); // exception throwing return x; } this.a = checkInt(x); this.b = checkInt(y); this.ab = this.a * this.b; } LCMCalculator.prototype = { // object literal for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jvscript01.wordpress.com&amp;blog=6793011&amp;post=1&amp;subd=jvscript01&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>SAMPLE CODES</strong></p>
<p>function LCMCalculator(x, y) { // constructor function<br />
    function checkInt(x) { // inner function<br />
        if (x % 1 != 0)<br />
            throw new TypeError(x + &#8221; is not an integer&#8221;); // exception throwing<br />
        return x;<br />
    }<br />
    this.a = checkInt(x);<br />
    this.b = checkInt(y);<br />
    this.ab = this.a * this.b;<br />
}<br />
LCMCalculator.prototype = { // object literal for constructor&#8217;s prototype<br />
    gcd : function() {<br />
        // Euclidean algorithm:<br />
        var a = Math.abs(this.a), b = Math.abs(this.b);<br />
        if (a &lt; b) {<br />
            var t = b; b = a; a = t; // swap variables<br />
        }<br />
        while (b != 0) {<br />
            t = b; // |t| already declared above (though we could redeclare if we wish)<br />
            b = a % b;<br />
            a = t;<br />
        }<br />
        // Only need to calculate gcd once, so redefine this method.<br />
        // &#8216;gcd&#8217; == &#8220;gcd&#8221;, this['gcd'] == this.gcd<br />
        this['gcd'] = function() { return a; };<br />
        return a;<br />
    },<br />
    lcm : function() {<br />
        // Variable names don&#8217;t collide with object properties, e.g. |lcm| is not |this.lcm|.<br />
        var lcm = this.ab / this.gcd();<br />
        // Only need to calculate lcm once, so redefine this method.<br />
        this.lcm = function() { return lcm; };<br />
        return lcm;<br />
    },<br />
    toString : function() {<br />
        return &#8220;LCMCalculator: a = &#8221; + this.a + &#8220;, b = &#8221; + this.b;<br />
    }<br />
};<br />
[[25,55],[21,56],[22,58],[28,56]].map(function(pair) { // array literal + mapping function<br />
    return new LCMCalculator(pair[0], pair[1]);<br />
}).sort(function(a, b) { // comparative function<br />
    return a.lcm() &#8211; b.lcm();<br />
}).forEach(function(obj) {<br />
    /* Note: println() is not an actual JS function, but let&#8217;s assume<br />
     * it&#8217;s functionally equivalent to Java&#8217;s System.out.println().<br />
     */<br />
    println(obj + &#8220;, gcd = &#8221; + obj.gcd() + &#8220;, lcm = &#8221; + obj.lcm());<br />
});<br />
// Note: Array&#8217;s map() and forEach() is predefined in JavaScript 1.6.<br />
The output is:<br />
LCMCalculator: a = 28, b = 56, gcd = 28, lcm = 56<br />
LCMCalculator: a = 21, b = 56, gcd = 7, lcm = 168<br />
LCMCalculator: a = 25, b = 55, gcd = 5, lcm = 275<br />
LCMCalculator: a = 22, b = 58, gcd = 2, lcm = 638</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jvscript01.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jvscript01.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jvscript01.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jvscript01.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jvscript01.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jvscript01.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jvscript01.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jvscript01.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jvscript01.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jvscript01.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jvscript01.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jvscript01.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jvscript01.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jvscript01.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jvscript01.wordpress.com&amp;blog=6793011&amp;post=1&amp;subd=jvscript01&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jvscript01.wordpress.com/2009/03/02/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8d54daea0b56a41e58a238ba63def5c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">apryll25</media:title>
		</media:content>
	</item>
	</channel>
</rss>
