console.log(subStrAfterChars('w3resource: JavaScript Exercises', ':'));
console.log(subStrAfterChars('w3resource: JavaScript Exercises', 'E'));
console.log(subStrAfterChars('w3resource: JavaScript Exercises', 'r'));
function subStrAfterChars(str,spc)
{
var temp =str.split('');
// console.log(temp);
var ar = [];
for(var i =0 ; i<temp.length ; i++)
{
if(temp[i] === spc)
{
ar.push(temp.slice(i+1,temp.length));
break;
}
}
return ar.join('').replaceAll(',','');
}
To embed this program on your website, copy the following code and paste it into your website's HTML: