Possibly a silly question, and i’m not sure how to phrase it.
I have an array in a function and I want put it through a loop print the text, not the variable. I’ve just starting banging my head on this, but whats really getting me is how to only print lets say the “category” and value if the value is not empty. Here’s and example to show, The outcome i’m looking for is “u =1 and x = 1 AND z = 3”. If anyone could point me in the write direction, it would be most helpful.
(categories called from multiple selection menus in text)
s=
t=
u=1
v=
w=
x=1
y=
z=3
function example(s,t,u,v,w,x,y,z) {
selection=[s,t,u,v,w,x,y,z];
for (var i=0;;i++)
{
if (!selection[i]) {
selection="";
}
else
{
selection= selection +
};
}
}
The outcome i’m looking for is
“u =1 and x = 1 AND z = 3”
I will provide semi functional code since I am not at my work desk. Assuming your variables are declared as parameters or as plain variables somewhere. You can declare a the names of variables as an array, loop over the array and use the eval function to evaluate their value