1var text = 'helloThereMister';
2var result = text.replace( /([A-Z])/g, " $1" );
3var finalResult = result.charAt(0).toUpperCase() + result.slice(1);
4console.log(finalResult);
1var name1 = "Taylor Johnson";
2var name2 ="taylor johnson";
3
4//convert to lowercase for case insensitive comparison
5if(name1.toLowerCase() === name2.toLowerCase()){
6 //names are the same
7}
8
9
1var haystack = "A. BAIL. Of. Hay.";
2var needle = "bail.";
3var needleRegExp = new RegExp(needle.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "i");
4var result = needleRegExp.test(haystack);
5if (result) {
6 // Your code here
7}