Line 2: We created a prototype object for string named found and equate it to null.
Line 3: We create str as String.
Line 7: Then in the code below it we find the pattern ‘str’ insensitive of case.
Line 17: Then we gave value to ‘found’ which can be used further.
- Line 3 is important here as prototype for String is given, so str = ‘my string’ will not work. We have to declare it as String type. Same is to be done if it is being used with other type or custom types.