The slice() method of {{jsxref("String")}} values extracts a section of this string and returns it as a new string, without modifying the original string.