string.toUpperCase
toUpperCase()
๋ฉ์๋๋ ํธ์ถ๋ ๋ฌธ์์ด ๊ฐ์ ๋๋ฌธ์๋ก ๋ณํํ์ฌ ๋ฐํํ๋ค. (๊ฐ์ด ์๋ ๊ฒฝ์ฐ ๋ฌธ์์ด๋ก ๋ณํ๋จ)
const sentence = 'The whiskers of a cat are highly sensitive to touch.';
sentence.toUpperCase(); // "THE WHISKERS OF A CAT ARE HIGHLY SENSITIVE TO TOUCH."
Syntax
str.toUpperCase()
Return value
๋๋ฌธ์๋ก ๋ณํ๋ ํธ์ถ ๋ฌธ์์ด์ ๋ํ๋ด๋ ์ ๋ฌธ์์ด
Exceptions
TypeError
Function.prototype.call()
์ ์ฌ์ฉํ์ฌ null
์ด๋ undefined
์ ํธ์ถ ํ ๋
## Description
`toUpperCase()` ๋ฉ์๋๋ ๋๋ฌธ์๋ก ๋ณํ๋ ๋ฌธ์์ด ๊ฐ์ ๋ฐํํ๋ค. JavaScript ๋ฌธ์์ด์ ๋ณ๊ฒฝํ ์ ์์ผ๋ฏ๋ก ์ด ๋ฉ์๋๋ ๋ฌธ์์ด ์์ฒด์ ๊ฐ์๋ ์ํฅ์ ๋ฏธ์น์ง ์๋๋ค.
## Examples
### ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ
```js
'alphabet'.toUpperCase(); // "ALPHABET"
๋ฌธ์์ด์ด ์๋ this์ ๋ฌธ์์ด ๋ณํ
๋ฌธ์์ด์ด ์๋ ๊ฐ์ ๋ฌธ์์ด๋ก ๋ณํํ๋ค. this
๋ฌธ์์ด์ด ์๋๋ฏ๋ก ๋ฌธ์์ด๋ก ๋ณํํ๋ค.
const a = String.prototype.toUpperCase.call({
toString: function toString() {
return 'abcdef';
}
});
a; // "ABCDEF"
const b = String.prototype.toUpperCase.call(true);
b; // "TRUE"
Last updated
Was this helpful?