๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
JAVASCRIPT

[JAVASCRIPT] ๋ฌธ์ž์—ด ๋ฉ”์„œ๋“œ : ๋Œ€์†Œ๋ฌธ์ž ๋ณ€๊ฒฝ๊ณผ ๊ณต๋ฐฑ ์ œ๊ฑฐ

by _ํ† ๋งคํ†  2022. 8. 18.
728x90

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ : ๋ฌธ์ž์—ด ๋ฉ”์„œ๋“œ : ๋Œ€์†Œ๋ฌธ์ž/๊ณต๋ฐฑ

์ง€๊ธˆ๋ถ€ํ„ฐ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ๋Œ€์†Œ๋ฌธ์ž ๋ณ€๊ฒฝ, ๊ณต๋ฐฑ ์ œ๊ฑฐ ๋ฌธ์ž์—ด ๋ฉ”์†Œ๋“œ์— ๋Œ€ํ•ด ์•Œ์•„๋ด…์‹œ๋‹ค!


#1. toUpperCase(), toLowerCase()

toUpperCase()๋Š” ๋ฌธ์ž์—ด์„ ๋Œ€๋ฌธ์ž๋กœ ๋ณ€๊ฒฝํ•ด์ฃผ๋ฉฐ toLowerCase()๋Š” ์†Œ๋ฌธ์ž๋กœ ๋ณ€๊ฒฝํ•ด์ค๋‹ˆ๋‹ค. ๋ณ€๊ฒฝ ํ›„์—๋Š” ์ƒˆ๋กœ์šด ๋ฌธ์ž์—ด๋กœ ๋ฐ˜ํ™˜ํ•ด์ค๋‹ˆ๋‹ค.

//01. ๋Œ€๋ฌธ์ž ๋ณ€๊ฒฝ
const str1 = "javascript";
const currentStr1 = str1.toUpperCase();

//02. ์†Œ๋ฌธ์ž ๋ณ€๊ฒฝ
const str2 = "JAVASCRIPT";
const currentStr2 = str1.toLowerCase();
ํ‘œ๋กœ ํ™•์ธํ•ด๋ณด์ž!
๋ฒˆํ˜ธ ๊ธฐ๋ณธ๊ฐ’ ๋ฉ”์„œ๋“œ ๋ฆฌํ„ด๊ฐ’
1 javascript toUpperCase() JAVASCRIPT
2 JAVASCRIPT toLowerCase() javascript

โœจ ์‘์šฉ ์ฝ”๋“œ๋กœ GO โœจ
ํ€ด์ฆˆ ๋งŒ๋“ค๊ธฐ 02์—์„œ๋„ ์œ„์˜ ๋ฉ”์„œ๋“œ๋ฅผ ์ด์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž ์ž…๋ ฅ๊ฐ’์„ ๋ณ€๊ฒฝ์‹œ์ผœ์ค๋‹ˆ๋‹ค.


#2. trim() , trimStart(), trimEnd()

trim()์€ ๋ฌธ์ž์—ด์˜ ์•ž๋’ค ๊ณต๋ฐฑ์„ ์ œ๊ฑฐํ•ด์ฃผ๋ฉฐ ์ƒˆ๋กœ์šด ๋ฌธ์ž์—ด๋กœ ๋ฐ˜ํ™˜์‹œ์ผœ ์ค๋‹ˆ๋‹ค.
trimStart(), trimEnd()๋„ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ trimStart()๋Š” ์•ž์˜ ๊ณต๋ฐฑ์„ trimEnd()์€ ๋’ค์˜ ๊ณต๋ฐฑ์„ ์ œ๊ฑฐํ•ด์ค๋‹ˆ๋‹ค.

//01. trim()
const str1 = "       javascript        ";
const currentStr1 = str1.trim();
    

//02. trimStart()
const str2 = "       javascript        ";
const currentStr2 = str2.trimStart();


//03. trimEnd()
const str3 = "       javascript        ";
const currentStr3 = str3.trimEnd();
ํ‘œ๋กœ ํ™•์ธํ•ด๋ณด์ž!
๋ฒˆํ˜ธ ๊ธฐ๋ณธ๊ฐ’ ๋ฉ”์„œ๋“œ ๋ฆฌํ„ด๊ฐ’
1    javascript    trim() javascript
2    javascript    trimStart() javascript   
3    javascript    trimEnd()    javascript
728x90

๋Œ“๊ธ€


Lucky Charms Rainbow
js
html
css