why doesn't the FAQ answer "How to iterate over the properties of anobject?"

J

Jake Barnes

<FAQENTRY>

Since I haven't coded Javascript in awhile, I find that with my
current job I need to remind myself of basic syntax. Just now I wanted
to look up how to iterate over an object. I was looking for a reminder
of how to do this:

for (var key in styleObject) {
alert(key + " is " + styleObject[key];
}

I found that after a moment of searching around.

Why isn't this in the FAQ? Surely it is a frequent question?

</FAQENTRY>
 
R

rf

Jake said:
<FAQENTRY>

Since I haven't coded Javascript in awhile, I find that with my
current job I need to remind myself of basic syntax. Just now I wanted
to look up how to iterate over an object. I was looking for a reminder
of how to do this:

for (var key in styleObject) {
alert(key + " is " + styleObject[key];
}

I found that after a moment of searching around.

Why isn't this in the FAQ? Surely it is a frequent question?

Maybe not. Maybe nobody needs to ask it so it is not, actually, asked
frequently.
 
T

Thomas 'PointedEars' Lahn

Jake Barnes <[email protected]>:
^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
Who are you?
for (var key in styleObject) {
alert(key + " is " + styleObject[key];
}

I found that after a moment of searching around.

Why isn't this in the FAQ?

Because, even if we ignored the syntax error, it would still be an
insufficient (and error-prone) solution.
Surely it is a frequent question?

IIRC not in itself.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top