Periksa koma di string javascript

var strs;
if( str.indexOf(',') != -1 ){
    strs = str.split(',');
}
Average Alpaca