๊ฒ์๋ฉ์๋4 ์๋ฐ์คํฌ๋ฆฝํธ : ๋ฌธ์์ด ๊ฒ์ ๋ฉ์๋ : charAt() ๋ฌธ์์ด ๊ฒ์ ๋ฉ์๋ : charAt() charAt() ๋ฉ์๋๋ ๋ฌธ์์ด์์ ํน์ ์ธ๋ฑ์ค์ ์์นํ๋ ๊ฐ์ ๋ฐํํฉ๋๋ค. charAt() ๋ฉ์๋ "๋ฌธ์์ด".charAt(์ซ์) const str1 = "javascript reference"; const currentStr1 = str1.charAt(); const currentStr2 = str1.charAt("0"); const currentStr3 = str1.charAt("1"); const currentStr4 = str1.charAt("2"); ๊ฒฐ๊ณผ๋ณด๊ธฐ j j a v 2022. 8. 22. ์๋ฐ์คํฌ๋ฆฝํธ : ๋ฌธ์์ด ๊ฒ์ ๋ฉ์๋ : match() ๋ฌธ์์ด ๊ฒ์ ๋ฉ์๋ : match() match() ๋ฉ์๋๋ ๋ฌธ์์ด(์ ๊ท์ ํฌํจ)์ ๊ฒ์ํ๊ณ , ๋ฐฐ์ด๋ก ๋ฐํํฉ๋๋ค. match() ๋ฉ์๋ 1. "๋ฌธ์์ด".match("๊ฒ์๊ฐ") const str1 = "javascript reference"; const currentStr1 = str1.match("javascript"); const currentStr2 = str1.match("reference"); const currentStr3 = str1.match("r"); ๊ฒฐ๊ณผ๋ณด๊ธฐ javascript reference r 2. "๋ฌธ์์ด".match(์ ๊ท์ ํํ) const str1 = "javascript reference"; const currentStr1 = str1.match(/reference/); co.. 2022. 8. 22. ์๋ฐ์คํฌ๋ฆฝํธ : ๋ฌธ์์ด ๊ฒ์ ๋ฉ์๋ : search() ๋ฌธ์์ด ๊ฒ์ ๋ฉ์๋ : search() search() ๋ฉ์๋๋ ๋ฌธ์์ด(์ ๊ท์ ํฌํจ)์ ๊ฒ์ํ๊ณ , ์์น๊ฐ(์ซ์)์ ๋ฐํํฉ๋๋ค. indexOf() ๋ฉ์๋์ ๊ฐ์ง๋ง, search() ๋ฉ์๋๋ ์ ๊ท์์ ์ฌ์ฉํ ์ ์๋ค๋ ์ ์์ ์ฐจ์ด๊ฐ ์์ต๋๋ค. search() ๋ฉ์๋ 1. "๋ฌธ์์ด".search("๊ฒ์๊ฐ") const str1 = "javascript reference"; const currentStr1 = str1.search("javascript"); const currentStr2 = str1.search("reference"); const currentStr3 = str1.search("j"); const currentStr4 = str1.search("a"); const currentStr5 = st.. 2022. 8. 22. ์๋ฐ์คํฌ๋ฆฝํธ : ๋ฌธ์์ด ๊ฒ์ ๋ฉ์๋ : indexOf() / lastIndexOf() ๋ฌธ์์ด ๊ฒ์ ๋ฉ์๋ : indexOf() / lastIndexOf() indexOf(), lastIndexOf() ๋ฉ์๋๋ ๋ฌธ์์ด์์ ํน์ ๋ฌธ์์ ์์น๋ฅผ ์ฐพ๊ณ , ๊ทธ ์์น๊ฐ์ ์ซ์๋ก ๋ฐํํฉ๋๋ค. indexOf() ๋ฉ์๋ indexOf() ๋ฉ์๋๋ ํธ์ถํ String ๊ฐ์ฒด์์ ์ฃผ์ด์ง ๊ฐ๊ณผ ์ผ์นํ๋ ์ฒซ ๋ฒ์งธ ์ธ๋ฑ์ค๋ฅผ ๋ฐํํฉ๋๋ค. ์ผ์นํ๋ ๊ฐ์ด ์์ผ๋ฉด -1์ ๋ฐํํฉ๋๋ค. 1. indexOf() : "๋ฌธ์์ด".indexOf(๊ฒ์๊ฐ) const str1 = "javascript reference"; const currentStr1 = str1.indexOf("javascript"); const currentStr2 = str1.indexOf("reference"); const currentStr3 = str1.in.. 2022. 8. 17. ์ด์ 1 ๋ค์ 728x90 ๋ฐ์ํ