//Using substring
 
var s = 'test:string';
 
var i = s.indexOf(':');
 
s = s.substring(0, i);
 
//Using split 
 
var s = 'test:string'; 
 
s.split(':')[0];

A personal technical diary… To the point… Precise