![]() ![]() ![]() The following example uses slice() to create a new string. Sintaxis cadena. Examples Using slice() to create a new string () Resumen El método slice () extrae una sección de una cadena y devuelve una cadena nueva. ![]() str.slice(1, 4) extracts the second character through the fourth character (characters indexed 1, 2, and 3).Īs an example, str.slice(2, -1) extracts the third character through the second to last character in the string. Slice() extracts up to but not including endSlice. Changes to the text in one string do not affect the other string. Slice() extracts the text from one string and returns a new string. Return valueĪ new string containing the extracted section of the string. If negative, it is treated as sourceLength + endSlice where sourceLength is the length of the string (for example, if endSlice is -3 it is treated as sourceLength - 3). If omitted, slice() extracts to the end of the string. The zero-based index at which to end extraction. If negative, it is treated as sourceLength + beginSlice where sourceLength is the length of the string (for example, if beginSlice is -3 it is treated as sourceLength - 3). slice(beginSlice ) Parameters beginSlice The zero-based index at which to begin extraction. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |