String Substring Method in JavaScript