I'm having trouble defining values in a way that I can call them later on.
If i define Search first, then Search.commands[3] is undefined. If i define commandList first then commandList.commands[0] is undefined.
Is there a better way to define these objects such that the order doesn't matter?
var Search = {
'str': 'search',
'param': 'search',
'action': '',
'commands': [
Category,
Location,
Sort,
commandList
]
}
var commandList = {
'commands': [
Search,
Category,
Stop
]
}
var Search = {
'str': 'search',
'param': 'search',
'action': ''
};
var commandList = {
'commands': [
Search,
Category,
Stop
]
};
Search.commands = [
Category,
Location,
Sort,
commandList
];
You could use something like this:
var Search = {
'str': 'search',
'param': 'search',
'action': ''
};
var commandList = {
};
Search.commands = [
Category,
Location,
Sort,
commandList
];
commandList.commands = [
Search,
Category,
Stop
];