Posted By

hand4ever on 07/04/10


Tagged

format array closure


Versions (?)

output an array without for or while loop


 / Published in: JavaScript
 

  1. var arr = [[1,2,3],[5,4,3],[7,6,5]];
  2. var out= (function($){
  3. return $.length? String($[0]).concat("\n").concat(arguments.callee($.slice(1))): "";
  4. })(arr);
  5. alert(out);
  6. /*output: 1,2,3
  7.   5,4,3
  8.   7,6,5
  9. */

Report this snippet  

You need to login to post a comment.