Q:

Uncaught SyntaxError: Unexpected number in comma seperated numbers

I have this code here:
<script type="text/javascript">
    var batchidstring = <?php echo $batchId; ?>;
</script>

$batchId value is 1,2,3,4,5
They were seperated with comma.
I get this error: 

Uncaught SyntaxError: Unexpected number

The error where in code  var batchidstring = 1,2,3,4,5;
Can anyone show me or correct the codes?

A:

if you need  string you must wrap the var  with proper quote 
var batchidstring = <?php echo "'" . $batchId . "'"; ?>;

