own (string) function via $.fn

own (string) function via $.fn

I'm a C#.NET developer and in JS/jQuery I missing the...
  1. "String".Replace("old","new");
...to replace all "old" substrings with a "new" substring inside a string.


jQuery code:
  1. $(document).ready(function(){
  2.  alert(('Hello [WORLD]. How are you, [WORLD]?').strReplace('[WORLD]','Michael'));

  3.  $.fn.strReplace = function(find,replace) { 
  4.   return this.split(find).join(replace);
  5.  }
  6. }


console output:
[jquery-3.3.1.min.js:2] Uncaught TypeError: "hallo".strReplace is not a function