padStart and padEnd methods | String Object In JavaScript

Published: 07 August 2022
on channel: Code Explained
5,269
115

🎁 Join my channel to get access to perks:
   / @codeexplained  

🧡 Hello All JavaScript Lovers Outhere!

Today you're going to learn about the String Object In JavaScript.

This tutorial is a series of videos, in each video we will discuss a method (or more) of the String Object in JavaScript.

In today's video, you're going to learn about the padStart, and padEnd methods.

The padStart() method pads the current string with another string (multiple times, if needed) until the resulting string reaches the given length. The padding is applied from the start of the current string.

The padEnd() method pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end of the current string.

🟢🟠 The string.padStart() and string.padEnd().
🔷 Syntax :
padStart(targetLength)
padStart(targetLength, padString)

padEnd(targetLength)
padEnd(targetLength, padString)

🔹targetLength : The length of the resulting string once the current str has been padded. If the value is less than str.length, then str is returned as-is.
🔹padString : The string to pad the current str with. If padString is too long to stay within the targetLength, it will be truncated from the end. The default value is the unicode "space" character (U+0020).

🌍 Social Media Links.
◾ Facebook :   / code.explained.official  
◾ Twitter :   / code_explained  
◾ Instagram :   / code.explained.official  
◾ GitHub : https://github.com/CodeExplainedRepo

💲 Suppport the Channel
Paypal : https://paypal.me/CodeExplained
Buy Me a Coffee: https://www.buymeacoffee.com/CodeExpl...


On this page of the site you can watch the video online padStart and padEnd methods | String Object In JavaScript with a duration of hours minute second in good quality, which was uploaded by the user Code Explained 07 August 2022, share the link with friends and acquaintances, this video has already been watched 5,269 times on youtube and it was liked by 115 viewers. Enjoy your viewing!