How can I take a sting containing numbers such as
1 - 2 - 3 - 4 - 5 - 6
and convert each number into a integer?
I have tried the following, but it just returns the first integer.
var a = '1 - 2 - 3 - 4 - 5 - 6';
var b = parseInt( a.split('-') );
$('#b').append(b);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id='b'></div>