12
如何检查字符串是否完全由相同的子字符串组成?
我必须创建一个接受字符串的函数,并且该函数应该返回true或false基于输入是否包含重复的字符序列。给定字符串的长度始终大于,1并且字符序列必须至少重复一次。 "aa" // true(entirely contains two strings "a") "aaa" //true(entirely contains three string "a") "abcabcabc" //true(entirely containas three strings "abc") "aba" //false(At least there should be two same substrings and nothing more) "ababa" //false("ab" exists twice but "a" is extra so false) 我创建了以下功能: function check(str){ if(!(str.length && str.length - 1)) …