extract characters from string before a character javascript code example Example: straforma in string js var x = new String("Una nuova stringa");