js count string in string code example Example: js string count (mainStr.split("str").length - 1) //4