2011-01-27 3 views

답변

4

var repeats = /(.)\1/; 

는 반복 문자와 임의의 문자열과 일치합니다.

따라서

if (repeats.test("hello")) alert("true because of the two 'l' characters"); 

if (!repeats.test("frederick the great")) alert("test fails because no characters repeat"); 
관련 문제