Ask Question
2 February, 12:30

What is the return value of "select". substring (4, 4) ?

+5
Answers (1)
  1. 2 February, 14:59
    0
    I'm assuming the syntax here is jа vascript:

    The str. substring () method takes in two integers - a start index and an end index - and returns all the characters in the specified range from the original string, including the character in the start index and excluding the character in the end index. jа vascript's is 0-indexed, which means that all of its indices start at 0.

    For instance, if we were to use the method on the string "test" and wanted to return the substring "tes", we'd call the following method:

    "test". substring (0,3)

    This would return everything from the first character, "t", up to but not including the fourth character, "t". The character immediately before the last "t" (index 3), "s" (index 2) would be our last character, and the console should print "tes" as a result.

    For your example, "select". substring (4,4) prints out every character starting at index 4 - the fifth character, "c" - up to but not including the character at index 4. We start and stop at the same character, so the method will only return the character "c", and nothing else.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is the return value of "select". substring (4, 4) ? ...” in 📙 Mathematics if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers