Store the Last Character
Here, we're trying to assign the last character of str to the variable lastChar. strings are zero-indexed, so the last character is not at
str[str.length]
, but at str[str.length - 1]
.Premium
JavaScript
Console