Jump to content

How do I use the incrementing values from a Loop inside an If statement


james909

Recommended Posts

Here is my code inside a function():

 

for (var i=1; i<6; i++) 
         {
for (var j=1; j<11; j++) 
           {
           if (h" + i + "w" + j" == "t") {
           var build = "Bulk"; }
           if (h" + i + "w" + j" == "z") {
           var build = "Master"; }
           if (h" + i + "w" + j" == "T") {
           var build = "Storage"; }
           parambuild = parambuild+build; 
           } 
         }

I am atempting to get check what letters globally declared vars: h1w1, h1w2, h1w3, h1w4 .... etc .... to h5w10 contain

 

and then make a string such as: BulkMasterBulkBulkStorageBulk

 

But in the current code the string contains: undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedun......

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.