Strings

String Positions

String Positions

Strings are ordered. The first character is at index 0, and the last character is at length - 1.

Read this code before running it:

js
const word = "debug";
const first = word[0];
const last = word[word.length - 1];
const joined = last + first;

Your task: Fill in the prediction variables with the values this code produces.

Prerequisites

  • variables
  • strings

Tests

  • predicts the first character from index zero
  • predicts the last character from length minus one
  • predicts the concatenated characters in order
Loading...
Console

Run code to see output.

Previous1 / 29Next