-3
我是编程新手,这个问题在编码训练营的入学考试中。我很好奇答案:测试一个字符串是否以另一个字符串开头,在JavaScript中
编写一个方法not_string,它接受一个字符串并返回该字符串,其前缀为“not”,除非原始字符串已经以全字“not”开头。
例如:
not_string("Hi, this is a string") #=> "not Hi, this is a string" not_string("not a string here") #=> "not a string here" not_string("nothing strange about this one") #=> "not nothing strange about this one"