Possible duplicate:
array join () method without separator
I use .join() to convert my array to a string so that I can output it to a text box when the user selects numbers in a calculator, I'm not quite sure how I can remove commas that are also displayed in the list. Can anyone advise how this can be achieved, or if there is another approach that I should use?
Js
$(document).ready(function() { var total = 0; var arr = []; //Testing $('#calculator').children('.num').on('click', function(e) { var clickedNumber = $(this).data('id'); arr.push(clickedNumber); console.log(arr.join()); e.preventDefault(); }); });β
JS Fiddle http://jsfiddle.net/CVr25/
javascript jquery
styler Aug 26 '12 at 17:11 2012-08-26 17:11
source share