I have below probably a bunch of problems but let's simplify them with easier examples.
Let assume two vars, a=cat
and b=a
, and you want to reference by b
s value a
to that var ie a
. So by which command I can do it? Variable SomeCommand(b)
and variable a
should point to the same memory space becaues b
gets evaluated to a
. The same question arises from the below code where we have the part document.getElementById(vals[0].split('|')[0]).style.display= 'block';
that should be evaluated to document.getElementById(picture).style.display= 'block';
ie to show picture but the above example is much cleaner to explain so refer to it, please. How to do the reference? Are the two ways above equivalent? I am watchful here because having encountered similar problems in other languages but then they were about inodes, symbolic/hard links and such things but no idea how this works in JS. Shortly, how do they get evaluated?
function change_visibility(binX)
{
// binX is a thing that matches `/^[10Xx]+$/`
// 1 = show the thing
// 0 = do not show the thing
// x/X = do not do anything
//
// for example, 00011x would turn OFF picture-quote-question_mark
// while turning ON search and help but not doing anything to
// typing pad's current state
var vals = ['picture|binX.charAt(0)',
'quote|binX.charAt(1)',
'question_mark|binX.charAt(2)',
'search|binX.charAt(3)',
'help|binX.charAt(4)',
'typingPad|binX.charAt(5)'
];
for (var i=0; i<vals.length; i++)
{
if(vals[i].split('|')[1]==1)
{
//TODO: check whether you can do it like this,
// assumed for example that vals[0].split('|')[0] =picture
// but it is not, the "inode" or let call it arrow is diffent!
// ERROR HERE ?!?
document.getElementById(vals[i].split('|')[0]).style.display= 'block';
}
else if(vals[i].split('|')[1]==0)
{
document.getElementById(vals[i].split('|')[0]).style.display= 'none';
}
}
}
Please, fix the labels if you know more descriptive alternatives.