var length = 3; var myString = "ABCDEFG"; var myTruncatedString = myString.substring(0,length); // The value of myTruncatedString is "ABC"