Js code that determines whether a character exists in a string



$(function(){
var str="sunny,woo";
var sear=new RegExp(',');
if(sear.test(str))
{
alert('Yes');
}
var tag=',';
if(str.indexOf(tag)!=-1)
{
alert('Yes');
}
});