๐ Reference
๐ย Chapter
true, ์ผ์นํ์ง ์์ผ๋ฉด false๋ฅผ ๋ฐํํ๋ค. (๋ถ๋ฆฌ์ธ ๊ฒฐ๊ณผ๋ง ํ์ํ ๋ ๊ฐ์ฅ ํจ์จ์ ์ด๋ค.)์ ๊ท์.test(๋ฌธ์์ด)true, ์๋๋ฉด false ๋ฐํtest()ย ๋ฉ์๋๋ ์ ๊ท ํํ์์ย lastIndex๋ฅผ ์
๋ฐ์ดํธํ๋ค. (RegExp.prototype.exec()๋ย lastIndexย ์์ฑ์ ์
๋ฐ์ดํธํ๋ค.)test(str)์ ๋ ํธ์ถํ๋ฉดย strย ๊ฒ์์ย lastIndex๋ถํฐ ๊ณ์ ์งํํ๋ค.ย lastIndexย ์์ฑ์ ๋งค ๋ฒย test()๊ฐย true๋ฅผ ๋ฐํํ ๋๋ง๋ค ์ฆ๊ฐํ๊ฒ ๋๋ค.test()๊ฐย true๋ฅผ ๋ฐํํ๊ธฐ๋ง ํ๋ฉดย lastIndex๋ ์ด๊ธฐํ๋์ง ์๋๋ค.test()๊ฐย false๋ฅผ ๋ฐํํ ๋ย lastIndexย ์์ฑ์ดย 0์ผ๋ก ์ด๊ธฐํ๋๋ค.regexObj.test(str);
(์ ๊ทํํ์).test("๋ฌธ์์ด");
str