Advertisement

05.15.2008 at 03:28PM PDT, ID: 23406925
[x]
Attachment Details

how can I pass an array  into an object ?

Asked by tech_question in JavaScript, Hypertext Markup Language (HTML), Dynamic HTML (DHTML)

Tags: javascript?, IE 6, internal

I have instantiated an object in java script. How can I pass a group of values into the object using a for loop and retrieve it ? Please note that the object also has a set of properties. Eg: there are six tax values in the below example and firstname and lastname. how can I use a for loop and insert them into the object and retrieve them ? there will always be only six tax values. should I MAKE an array or hash values for the 6 TAX VALUES ?   I need to use the for loop only to retrieve the six tax values not the firstname and lastname. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var obj = new Object();
 
obj.firstName = "test";
obj.lastName = "test2";
 
obj.tax1 = 1;
obj.tax2 = 2;
obj.tax3 = 3;
obj.tax4 = 4;
obj.tax5 = 5;
obj.tax6 = 6;
 
Loading Advertisement...
 
[+][-]05.15.2008 at 09:02PM PDT, ID: 21579905

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 01:15AM PDT, ID: 21580810

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 07:14AM PDT, ID: 21582850

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Hypertext Markup Language (HTML), Dynamic HTML (DHTML)
Tags: javascript?, IE 6, internal
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628