var str = '012123'; var strFirstThree = str.substring(0,3); console.log(str); //shows '012123' console.log(strFirstThree); // shows '012'