<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-4896534028551173029</id><updated>2009-02-21T07:40:45.359-08:00</updated><title type='text'>Welcome to Roshan's blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://roshankumarblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4896534028551173029/posts/default'/><link rel='alternate' type='text/html' href='http://roshankumarblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Roshan</name><uri>http://www.blogger.com/profile/18271752728712722507</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4896534028551173029.post-2148926875815957268</id><published>2008-03-17T16:10:00.000-07:00</published><updated>2008-03-17T16:55:36.028-07:00</updated><title type='text'>Javascript Programming: Object attributes looping</title><content type='html'>&lt;span style="font-size:+0;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;In javascript, a variable can be defined using ‘var’ statement. One can define an ‘Object’ variable and associate attributes instantly, as shown in example below:&lt;br /&gt;&lt;br /&gt;    var oPerson = new Object();&lt;br /&gt;    oPerson.Name = 'Roshan Kumar';&lt;br /&gt;    oPerson.Age = 26;&lt;br /&gt;    oPerson.City = 'Mumbai';&lt;br /&gt;&lt;br /&gt;Now, suppose I have such an object and I want to loop through all the attributes associated with ‘Object’ variable. (This could be required if you get such object as function parameter and you do not know the actual attributes associated with it.) Try following piece of code.&lt;br /&gt;&lt;br /&gt;    var attributeList = "";&lt;br /&gt;    for (var attribute in oPerson)&lt;br /&gt;    {&lt;br /&gt;        if(attribute == 'clone') continue;&lt;br /&gt;        attributeList += String(attribute) + ": " + eval('oPerson.' + String(attribute)) + "\n";&lt;br /&gt;    }&lt;br /&gt;    alert(attributeList);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;I am not sure why an attribute with clone appears.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4896534028551173029-2148926875815957268?l=roshankumarblog.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://roshankumarblog.blogspot.com/feeds/2148926875815957268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4896534028551173029&amp;postID=2148926875815957268' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4896534028551173029/posts/default/2148926875815957268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4896534028551173029/posts/default/2148926875815957268'/><link rel='alternate' type='text/html' href='http://roshankumarblog.blogspot.com/2008/03/javascript-programming-object.html' title='Javascript Programming: Object attributes looping'/><author><name>Roshan</name><uri>http://www.blogger.com/profile/18271752728712722507</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='12594395370344814334'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>