redho home | products | services
Web Design Forums

Web Design Forums  


Web Hosting, Web Design, Software and Web Development Forums  
 FAQFAQ   MemberlistArchive  Log inLog in   RegisterRegister 
         

how to see all object attributes?



 
Post new topic   Reply to topic    Web Design Forums -> JavaScript forum
View previous topic :: View next topic  
Author Message
AmeliaR



Joined: 31 May 2006
Posts: 142
How do I see all object attributes/properties ?
I try for (x in arr){ alert(arr[x]);}
But it shows only value
  Reply with quote


Kopilman



Joined: 25 May 2006
Posts: 162
AmeliaR, alert(x + " " + arr[x]) would show keys as well
  Reply with quote
AmeliaR



Joined: 31 May 2006
Posts: 142
Uuh
ThanAmeliaR
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
But I don't have a nicer solution that doesn't involve tons of alerts.
  Reply with quote
AmeliaR



Joined: 31 May 2006
Posts: 142
Can I concatenate all pairs in a string ?
Like alert (concat(o)) ?
So it shows k=>v pairs
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
As far as I know, Javascript lacAmeliaR reduce(), map(), etc.
  Reply with quote
AmeliaR



Joined: 31 May 2006
Posts: 142
Pity
  Reply with quote
Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
Function foo(o) { var a = []; for(var p in o) a.push(p); a.sort(); for(var i = 0; i < a.length; i++) a[i] = a[i]+'='+o[a[i]]; alert(a.join('\n')); }
Foo(someobject);
  Reply with quote
AmeliaR



Joined: 31 May 2006
Posts: 142
Neat
  Reply with quote
Page 1 of 1
Post new topic   Reply to topic    Web Design Forums -> JavaScript forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group