Answers for "javascript get all characters before a certain one"

0

javascript get all characters before a certain one

// say you wanted to collect all the chars before a slash (/).

myString = "12345.67890";

newString = myString.substring(0, myString.indexOf('/'));

console.log(newString);

// returns "12345"
Posted by: Guest on February-08-2021

Code answers related to "javascript get all characters before a certain one"

Code answers related to "Javascript"

Browse Popular Code Answers by Language