Apologies for the messy code, but I'm facing an issue with my JavaScript
. I can't figure out why the specified child
is not considered as a task to derive from
:
var childrenToOperateOn = [];
for (var i = 0; i < $scope.derivedTasksToIndent.length; i++) {
if($scope.derivedTasksToIndent[i].todosernm == todo.todosern){
childrenToOperateOn.push($scope.derivedTasksToIndent[i]);
console.log("Affecting child: " + $scope.derivedTasksToIndent[i].todotask);
for (var child in childrenToOperateOn) {
console.log("Confirm child: " + child.todotask);
}
}
}
Instead of retrieving the expected value from the childrenToOperateOn
array, all I get is undefined
:
(index):145 Affecting child: A task to derive from
(index):147 Confirm child: undefined
I am using AngularJS
, in case that information helps in any way.
How can I ensure that the correct value and its properties are retained? What mistake am I making here?