What does `String.prototype.slice(-3)` do on ‘Hello’?

JavaScript Professional Easy

JavaScript Professional — Easy

What does `String.prototype.slice(-3)` do on ‘Hello’?

Key points

  • The negative index `-3` counts from the end of the string
  • The method extracts characters from that index to the end
  • It does not include the character at the negative index itself

Ready to go further?

Related questions