split string between "><" in javascript

You can use the split() method to split a string into an array of substrings. In this case, you can split the string between "><" as follows:

index.tsx
const str = "hello><world><foo><bar";
const arr = str.split("><");
console.log(arr); // ["hello", "world", "foo", "bar"]
121 chars
4 lines

The split() function splits the string on the "><" characters, and returns an array of substrings.

related categories

gistlibby LogSnag