[Edit]
+
0
-
0

JavaScript - remove everything before certain character (including)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
const findText = (text, character) => { const index = text.indexOf(character); if (index !== -1) { return text.substring(index + 1); } return text; }; // Usage example: const text = 'Removed part-example text...'; const character = '-'; const result = findText(text, character); console.log(result); // example text... // Output: // // example text...