This isn’t working as I expected:
for sup in sups
getStudents sup.CLKEY, (studs) ->
console.log "Manager: #{sup.LNAME} Managed By: #{sup.MLNAME}"
for stud in studs
console.log "Student #{stud.LNAME} Managed By: #{sup.LNAME}"
getStudents receives each sup.CLKEY, but the rest of the references to sup return value from the last one in the array.
In other words, sup.LNAME and sup.MLNAME in the console.log statements are always from the last sup in the array
How do I nest the 2nd loop so that it stays on the current sup?
Adding “do” made this work:
I couldn’t get Kim’s original solution to work (but it’s since been changed to reflect using “do”).