A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/lodash-_-padend-method/ below:

Lodash _.padEnd() Method - GeeksforGeeks

Lodash _.padEnd() Method

Last Updated : 03 Nov, 2023

Lodash _.padEnd() method is used to pad a string with another string until it reaches the given length. The padding is applied from the right end of the string. Padding characters are truncated if they exceed the length.

Syntax:
_.padEnd( [string = ''], [length = 0], [chars = ' '] );
Parameters: Return Value:

This method returns the padded string.

Example 1: In this example, we are adding the given string at the end of the given original string with the help of the lodash _.padEnd() method.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");

// Use of _.padEnd() method 
console.log(_.padEnd('GFG', 5));
console.log(_.padEnd('1234', 6, '#'));

Output:

'GFG  '
'1234##'

Example 2: In this example, we are adding the given string at the end of the given original string with the help of the lodash _.padEnd() method.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");

// Use of _.padEnd() method 
console.log(_.padEnd('GFG', 6, '-'));
console.log(_.padEnd('1234', 3, '#')); 

Output:

'GFG---'
'1234'


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4