2020-07-25

JavaScript - String first n delimited elements

original = "element1_element2_e3_e4_e5";

result = original.split("_").slice(0, 3).join("_");

console.log(result);

No comments:

Post a Comment