<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Prototype JavaScript framework - Object</title>
  <id>tag:prototypejs.org,2008:mephisto/api/object</id>
  <generator uri="http://mephistoblog.com" version="0.7.3">Mephisto Noh-Varr</generator>
  <link href="http://prototypejs.org/feed/api/object/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://prototypejs.org/api/object" rel="alternate" type="text/html"/>
  <updated>2007-11-08T01:54:24Z</updated>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-08:17820</id>
    <published>2007-11-08T01:39:00Z</published>
    <updated>2007-11-08T01:54:24Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/tohtml" rel="alternate" type="text/html"/>
    <title>toHTML</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;toHTML(obj) -&gt; String&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns the return value of &lt;code&gt;obj&lt;/code&gt;&#8217;s &lt;code&gt;toHTML&lt;/code&gt; method if it exists, else runs &lt;code&gt;obj&lt;/code&gt; through &lt;code&gt;String.interpret&lt;/code&gt;.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;toHTML(obj) -&gt; String&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns the return value of &lt;code&gt;obj&lt;/code&gt;&#8217;s &lt;code&gt;toHTML&lt;/code&gt; method if it exists, else runs &lt;code&gt;obj&lt;/code&gt; through &lt;code&gt;String.interpret&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
var Bookmark = Class.create({
  initialize: function(name, url) {
    this.name = name;
    this.url = url;
  },

  toHTML: function() {
    return '&amp;lt;a href=&quot;#{url}&quot;&amp;gt;#{name}&amp;lt;/a&amp;gt;'.interpolate(this);
  }
});

var api = new Bookmark('Prototype API', 'http://prototypejs.org/api');

Object.toHTML(api);
//-&gt; '&amp;lt;a href=&quot;http://prototypejs.org/api&quot;&amp;gt;Prototype API&amp;lt;/a&amp;gt;'

Object.toHTML(&quot;Hello world!&quot;);
//-&gt; &quot;Hello world!&quot;

Object.toHTML();
//-&gt; &quot;&quot;

Object.toHTML(null);
//-&gt; &quot;&quot;

Object.toHTML(undefined);
//-&gt; &quot;&quot;

Object.toHTML(true);
//-&gt; &quot;true&quot;

Object.toHTML(false);
//-&gt; &quot;false&quot;

Object.toHTML(123);
//-&gt; &quot;123&quot;
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-08:17819</id>
    <published>2007-11-08T01:36:00Z</published>
    <updated>2007-11-08T01:38:15Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/isfunction" rel="alternate" type="text/html"/>
    <title>isFunction</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isFunction(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is of type &lt;code&gt;function&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isFunction(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is of type &lt;code&gt;function&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.isFunction($);
//-&gt; true

Object.isFunction(123);
//-&gt; false
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-08:17818</id>
    <published>2007-11-08T01:33:00Z</published>
    <updated>2007-11-08T01:36:22Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/isnumber" rel="alternate" type="text/html"/>
    <title>isNumber</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isNumber(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is of type &lt;code&gt;number&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isNumber(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is of type &lt;code&gt;number&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.isNumber(0);
//-&gt; true

Object.isNumber(1.2);
//-&gt; true

Object.isNumber(&quot;foo&quot;);
//-&gt; false
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-08:17817</id>
    <published>2007-11-08T01:31:00Z</published>
    <updated>2007-11-08T01:32:37Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/isstring" rel="alternate" type="text/html"/>
    <title>isString</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isString(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is of type &lt;code&gt;string&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isString(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is of type &lt;code&gt;string&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.isString(&quot;foo&quot;);
//-&gt; true

Object.isString(&quot;&quot;);
//-&gt; true

Object.isString(123);
//-&gt; false
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-08:17816</id>
    <published>2007-11-08T01:28:00Z</published>
    <updated>2007-11-08T01:30:50Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/isundefined" rel="alternate" type="text/html"/>
    <title>isUndefined</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isUndefined(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is of type &lt;code&gt;undefined&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isUndefined(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is of type &lt;code&gt;undefined&lt;/code&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.isUndefined();
//-&gt; true

Object.isUndefined(undefined);
//-&gt; true

Object.isUndefined(null);
//-&gt; false

Object.isUndefined(0);
//-&gt; false

Object.isUndefined(&quot;&quot;);
//-&gt; false
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-08:17815</id>
    <published>2007-11-08T01:24:00Z</published>
    <updated>2007-11-08T01:26:43Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/ishash" rel="alternate" type="text/html"/>
    <title>isHash</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isHash(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is an instance of the &lt;a href=&quot;/api/hash&quot;&gt;&lt;code&gt;Hash&lt;/code&gt; class&lt;/a&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isHash(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is an instance of the &lt;a href=&quot;/api/hash&quot;&gt;&lt;code&gt;Hash&lt;/code&gt; class&lt;/a&gt;, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.isHash(new Hash({ }));
//-&gt; true

Object.isHash($H({ }));
//-&gt; true

Object.isHash({ });
//-&gt; false
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-08:17814</id>
    <published>2007-11-08T01:22:00Z</published>
    <updated>2007-11-08T01:23:56Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/isarray" rel="alternate" type="text/html"/>
    <title>isArray</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isArray(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is an array, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isArray(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is an array, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.isArray([]);
//-&gt; true

Object.isArray($w());
//-&gt; true

Object.isArray({ });
//-&gt; false
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-08:17813</id>
    <published>2007-11-08T01:16:00Z</published>
    <updated>2007-11-08T01:21:05Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/iselement" rel="alternate" type="text/html"/>
    <title>isElement</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isElement(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is a DOM node of type 1, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;isElement(obj) -&gt; Boolean&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;obj&lt;/code&gt; is a DOM node of type 1, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;
&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.isElement(new Element('div'));
//-&gt; true

Object.isElement(document.createElement('div'));
//-&gt; true

Object.isElement($('id_of_an_exiting_element'));
//-&gt; true

Object.isElement(document.createTextNode('foo'));
//-&gt; false
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-11-07:17802</id>
    <published>2007-11-07T21:01:00Z</published>
    <updated>2007-11-07T21:52:28Z</updated>
    <category term="Object"/>
    <category term="1.6"/>
    <link href="http://prototypejs.org/api/object/toquerystring" rel="alternate" type="text/html"/>
    <title>toQueryString</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;toQueryString(obj) -&gt; String&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Turns an object into its URL-encoded query string representation.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;toQueryString(obj) -&gt; String&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Turns an object into its URL-encoded query string representation.&lt;/p&gt;
&lt;p&gt;This is a form of serialization, and is mostly useful to provide complex parameter sets for stuff such as objects in the Ajax namespace (e.g. &lt;a href=&quot;/api/ajax/request&quot;&gt;&lt;code&gt;Ajax.Request&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Undefined-value pairs will be serialized as if empty-valued.  Array-valued pairs will get serialized with one name/value pair per array element.  All values get URI-encoded using JavaScript&#8217;s native &lt;code&gt;encodeURIComponent&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;The order of pairs in the serialized form is not guaranteed (and mostly irrelevant anyway), except for array-based parts, which are serialized in array order.&lt;/p&gt;

&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;Object.toQueryString({ action: 'ship', order_id: 123, fees: ['f1', 'f2'], 'label': 'a demo' })
// -&gt; 'action=ship&amp;order_id=123&amp;fees=f1&amp;fees=f2&amp;label=a%20demo'
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-03-10:14774</id>
    <published>2007-03-10T00:57:00Z</published>
    <updated>2007-11-07T21:10:04Z</updated>
    <category term="Object"/>
    <category term="1.5.1"/>
    <link href="http://prototypejs.org/api/object/tojson" rel="alternate" type="text/html"/>
    <title>toJSON</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;toJSON(obj) -&gt; String&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns a JSON string.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;toJSON(obj) -&gt; String&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns a JSON string.&lt;/p&gt;
&lt;p&gt;For more information on Prototype&#8217;s JSON encoder, hop to our &lt;a href=&quot;/learn/json&quot;&gt;tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Example&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
var data = {name: 'Violet', occupation: 'character', age: 25, pets: ['frog', 'rabbit']};
Object.toJSON(data);
//-&gt; '{&quot;name&quot;: &quot;Violet&quot;, &quot;occupation&quot;: &quot;character&quot;, &quot;age&quot;: 25, &quot;pets&quot;: [&quot;frog&quot;,&quot;rabbit&quot;]}'
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-01-08:13011</id>
    <published>2007-01-08T18:14:00Z</published>
    <updated>2007-01-10T08:43:59Z</updated>
    <category term="Object"/>
    <link href="http://prototypejs.org/api/object/values" rel="alternate" type="text/html"/>
    <title>values</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.values(obj) -&gt; Array&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Treats any object as a &lt;a href=&quot;/api/hash&quot;&gt;&lt;code&gt;Hash&lt;/code&gt;&lt;/a&gt; and fetches the list of its property values.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.values(obj) -&gt; Array&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Treats any object as a &lt;a href=&quot;/api/hash&quot;&gt;&lt;code&gt;Hash&lt;/code&gt;&lt;/a&gt; and fetches the list of its property values.&lt;/p&gt;
&lt;p&gt;Note that the order of the resulting Array is browser-dependent (it relies on the &lt;code&gt;for&amp;amp;#8230;in&lt;/code&gt; loop), and is therefore not guaranteed to follow either declaration or lexicographical order.  Also, remember that while property names are unique, property values have no constraint whatsoever.&lt;/p&gt;

&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.values()
// -&gt; []

Object.values({ name: 'Prototype', version: 1.5 }).sort()
// -&gt; [1.5, 'Prototype']
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-01-08:13010</id>
    <published>2007-01-08T18:13:00Z</published>
    <updated>2007-01-10T08:43:27Z</updated>
    <category term="Object"/>
    <link href="http://prototypejs.org/api/object/keys" rel="alternate" type="text/html"/>
    <title>keys</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.keys(obj) -&gt; [String...]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Treats any object as a &lt;a href=&quot;/api/hash&quot;&gt;&lt;code&gt;Hash&lt;/code&gt;&lt;/a&gt; and fetches the list of its property names.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.keys(obj) -&gt; [String...]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Treats any object as a &lt;a href=&quot;/api/hash&quot;&gt;&lt;code&gt;Hash&lt;/code&gt;&lt;/a&gt; and fetches the list of its property names.&lt;/p&gt;
&lt;p&gt;Note that the order of the resulting Array is browser-dependent (it relies on the &lt;code&gt;for&amp;amp;#8230;in&lt;/code&gt; loop), and is therefore not guaranteed to follow either declaration or lexicographical order.  Sort the array if you wish to guarantee order.&lt;/p&gt;

&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.keys()
// -&gt; []

Object.keys({ name: 'Prototype', version: 1.5 }).sort()
// -&gt; ['name', 'version']
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-01-08:13008</id>
    <published>2007-01-08T18:03:00Z</published>
    <updated>2007-01-10T08:41:46Z</updated>
    <category term="Object"/>
    <link href="http://prototypejs.org/api/object/clone" rel="alternate" type="text/html"/>
    <title>clone</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.clone(obj) -&gt; Object&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Clones the passed object using shallow copy (copies all the original&#8217;s properties to the result).&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.clone(obj) -&gt; Object&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Clones the passed object using shallow copy (copies all the original&#8217;s properties to the result).&lt;/p&gt;
&lt;p&gt;Do note that this is shallow copy, not deep copy.&lt;/p&gt;

&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
var o = { name: 'Prototype', version: 1.5, authors: ['sam', 'contributors'] };
var o2 = Object.clone(o);

o2.version = '1.5 weird';
o2.authors.pop();

o.version
// -&gt; 1.5

o2.version
// -&gt; '1.5 weird'

o.authors
// -&gt; ['sam'] // Ouch!  Shallow copy!
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-01-08:13009</id>
    <published>2007-01-08T18:03:00Z</published>
    <updated>2007-01-10T08:42:22Z</updated>
    <category term="Object"/>
    <link href="http://prototypejs.org/api/object/extend" rel="alternate" type="text/html"/>
    <title>extend</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.extend(dest, src) -&gt; alteredDest&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Copies all properties from the source to the destination object.  Used by Prototype to simulate inheritance (rather statically) by copying to prototypes.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.extend(dest, src) -&gt; alteredDest&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Copies all properties from the source to the destination object.  Used by Prototype to simulate inheritance (rather statically) by copying to prototypes.&lt;/p&gt;
&lt;p&gt;Documentation should soon become available that describes how Prototype implements OOP, where you will find further details on how Prototype uses &lt;code&gt;Object.extend&lt;/code&gt; and &lt;code&gt;Class.create&lt;/code&gt; (something that may well change in version 2.0).  It will be linked from here.&lt;/p&gt;

&lt;p&gt;Do not mistake this method with its quasi-namesake &lt;a href=&quot;/api/element/extend&quot;&gt;&lt;code&gt;Element.extend&lt;/code&gt;&lt;/a&gt;, which implements Prototype&#8217;s (much more complex) DOM extension mechanism.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://prototypejs.org/">
    <author>
      <name>Tobie</name>
    </author>
    <id>tag:prototypejs.org,2007-01-08:13004</id>
    <published>2007-01-08T17:02:00Z</published>
    <updated>2007-01-10T08:42:59Z</updated>
    <category term="Object"/>
    <link href="http://prototypejs.org/api/object/inspect" rel="alternate" type="text/html"/>
    <title>inspect</title>
<summary type="html">&lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.inspect(obj) -&gt; String&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns the debug-oriented string representation of the object.&lt;/p&gt;</summary><content type="html">
            &lt;pre&gt;&lt;code class=&quot;ebnf&quot;&gt;Object.inspect(obj) -&gt; String&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Returns the debug-oriented string representation of the object.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;undefined&lt;/code&gt; and &lt;code&gt;null&lt;/code&gt; are represented as such.&lt;/li&gt;
&lt;li&gt;Other types are looked up for a &lt;code&gt;inspect&lt;/code&gt; method: if there is one, it is used, otherwise, it reverts to the &lt;code&gt;toString&lt;/code&gt; method.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Prototype provides &lt;code&gt;inspect&lt;/code&gt; methods for many types, both built-in and library-defined, such as in &lt;a href=&quot;/api/string/inspect&quot;&gt;&lt;code&gt;String&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;/api/array/inspect&quot;&gt;&lt;code&gt;Array&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;/api/enumerable/inspect&quot;&gt;&lt;code&gt;Enumerable&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;/api/hash/inspect&quot;&gt;&lt;code&gt;Hash&lt;/code&gt;&lt;/a&gt;, which attempt to provide most-useful string representations (from a developer&#8217;s standpoint) for their respective types.&lt;/p&gt;

&lt;h3&gt;Examples&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;
Object.inspect()
// -&gt; 'undefined'

Object.inspect(null)
// -&gt; 'null'

Object.inspect(false)
// -&gt; 'false'

Object.inspect([1, 2, 3])
// -&gt; '[1, 2, 3]'

Object.inspect('hello')
// -&gt; &quot;'hello'&quot;
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
</feed>
