string.startsWith
startWith() ๋ฉ์๋๋ ์ด๋ค ๋ฌธ์์ด์ด ํน์ ๋ฌธ์๋ก ์์ํ๋์ง ํ์ธํ์ฌ ๊ฒฐ๊ณผ๋ฅผ true ๋๋ false ๋ก ๋ฐํํ๋ค.
Syntax
str.startsWith(searchString[, postion])Parameters
searchStarting
์ด ๋ฌธ์์ด์ ์์ ๋ถ๋ถ์์ ๊ฒ์ํ ๋ฌธ์
position (Optional)
๋ฌธ์์ด์์ searchString ๊ฒ์์ ์์ํ ์์น์ด๋ค. ๊ธฐ๋ณธ๊ฐ์ 0์ด๋ค.
Return value
์ฃผ์ด์ง ๋ฌธ์์ด์ด ๋ฌธ์๊ฐ ๋ฌธ์์ด์ ์์ ๋ถ๋ถ์์ ๋ฐ๊ฒฌ๋๋ฉด true, ๊ทธ๋ ์ง ์์ผ๋ฉด false
Description
์ด ๋ฌธ์์ด์ด ๋ค๋ฅธ ๋ฌธ์์ด๋ก ์์ํ๋์ง ํ์ธํ ์ ์๋ค. ๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ๋ค.
Examples
startsWith() ์ฌ์ฉํ๊ธฐ
Polyfill
startsWith ๋ฉ์๋๋ ECMAScript 2015 ๋ช ์ธ์ ์ถ๊ฐ๋์๋ค.
ES2015 ๊ท๊ฒฉ ์ค์์ ๊ฒฌ๊ณ ํ์ง๋ง ํผํฌ๋จผ์ค๋ ๋จ์ด์ง๋ Polyfill์ Mathias Bynens์ GitHub ์์ ํ์ธํ ์ ์๋ค.
Last updated
Was this helpful?