What does `String.prototype.padStart(5, ‘0’)` do to ’42’?

JavaScript Developer Easy

JavaScript Developer — Easy

What does `String.prototype.padStart(5, ‘0’)` do to ’42’?

Key points

  • `padStart` adds padding to the start of a string
  • The first argument is the total length after padding
  • The second argument specifies the character to pad with
  • The correct answer adds zeros to make the total length 5
  • Incorrect options do not add the correct amount of padding

Ready to go further?

Related questions