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...


Watch video padStart and padEnd methods | String Object In JavaScript online without registration, duration hours minute second in high quality. This video was added by user Code Explained 07 August 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 5,269 once and liked it 115 people.