1772298f2d14152c13bbd3221e6ab6ec

I just can't help but feel like this could be done in a much smoother way, but I'm not sure how to easily gather all the values I need in a separate array so I can join them together in a string afterwards. Any ideas?

summary.detentionComments = []; 
   $.map(summary.detentionNotes, function(note) { summary.detentionComments.push(note.comments) });
   summary.detentionComments = summary.detentionComments.join("; ");

Refactorings

No refactoring yet !

A8d3f35baafdaea851914b17dae9e1fc

Adam

June 3, 2011, June 03, 2011 14:16, permalink

No rating. Login to rate!
summary.detentionComments = summary.detentionNotes.map(function(note) { return note.comments }).join("; ");
1772298f2d14152c13bbd3221e6ab6ec

https://www.google.com/accounts/o8/id?id=AItOawmRvMhcLFwL72d7b-9gx7YpThiobwkY3Co

June 3, 2011, June 03, 2011 15:45, permalink

No rating. Login to rate!

Ahh, of course, seems so simple now! Thanks!

Your refactoring





Format Copy from initial code

or Cancel