Javascript Computed Values With Arrays

Posted by user983969 on Stack Overflow See other posts from Stack Overflow or by user983969
Published on 2012-06-22T15:02:23Z Indexed on 2012/06/22 15:16 UTC
Read the original article Hit count: 178

Jquery Each Json Values Issue

This question is similar to above, but not the same before it gets marked duplicated.

After realasing how to use computed values i came across another issue.

In my javascript i have the following code:

var incidentWizard = ['page1.html','page2.html','page3.html'];
var magicWizard = ['page1.html','page2.html','page3.html'];
var loadedURL = 'page1.html';

The input to this function would be (true,'incident')

function(next,wizardname)
 {

   var WizSize = incidentWizard.length; 
    wizardName = [wizardName] + 'Wizard';

   var wizardPOS = jQuery.inArray(loadedURL,incidentWizard);

And now i want to use the wizardname parameter to decide what array i am going to use...

Loader(incidentWizard[wizardPOS],true);

Ive also tried

Loader([incidentWizard][wizardPOS],true);

and

Loader([incidentWizard][wizardPOS],true);

Also the loader function just required the string value in the array at wizardPOS sorry for confusion

But when trying this i always end up with the outcome...

/incidentWizard  

I know this is something to do with using computed values but i've tried reading about them and cant seem to solve this issue.

Basicly i want to use the computed value of wizardName to access an an array of that name.

Please help supports, looking forward to seeing many ways to do this!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about arrays