Here's how to replace the word "dog" with the word "cat" in the given sentence in typescript:
index.ts219 chars4 lines
The replace()
method is called on the sentence string with two arguments; the first argument is the string to be replaced ("dog"), and the second argument is the string to be substituted in its place ("cat"). The method returns a new string with the replacement made.
gistlibby LogSnag