일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- Review
- Temporal dead zone
- yet
- textContent
- keyboardEvent
- modal
- js
- for loop
- Empty
- UI
- ES5
- nodeValue
- javascript
- addEventListener
- innerHTML
- css:position
- CSS
- a11y
- TypingEffect
- react
- HTML
- beforeinput
- node
- Dom
- es6
- node.js
- keyup
- Event
- innerText
- dotenv
- Today
- Total
the murmurous sea
JS: padStart() & padEnd() 본문
padStart()
1. pads the current string with another string (multiple times, if needed) until the resulting string reaches the given length.
2. The padding is applied from the start of the current string.
[Syntax]
str.padStart(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 | Optional | 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 " " (U+0020 'SPACE'). |
[Return Value]
A String of the specified targetLength with padString applied from the start of the current str.
padEnd()
1. pads the current string with a given string (repeated, if needed) so that the resulting string reaches a given length.
2. The padding is applied from the end of the current string.
[Syntax]
str.padEnd(targetLength [, padString])
targetLength | The length of the resulting string once the current str has been padded. | |
If the value is lower than str.length, the current string will be returned as-is. | ||
padString | Optional | The string to pad the current str with. |
If padString is too long to stay within targetLength, it will be truncated | ||
The default value for this parameter is " " (U+0020 'SPACE'). |
[Return Value]
A String of the specified targetLength with the padString applied at the end of the current str.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd
'#dev > 개념정리' 카테고리의 다른 글
JS, ES1: splice() (0) | 2020.05.04 |
---|---|
JS, ES1: split() (0) | 2020.05.04 |
[HTML DOM] DocumentFragment (0) | 2020.05.02 |
HTML DOM: insertBefore() (0) | 2020.05.02 |
선언적 함수 vs 함수표현식 vs 익명함수 (waiting list) (0) | 2020.05.02 |