在本例中,我们将执行一次全局替换,每当 "Microsoft" 被找到,它就被替换为 "Runoob":var str="Visit Microsoft!";var n=str.replace("Microsoft","Runoob");n 输出结果:Visit Runoob!