Javascript replace()函数 [英] Javascript replace() function
本文介绍了Javascript replace()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个简单的replace()问题-我无法在下面的函数中替换子字符串.
This is a simple replace() question - and I can't get it working to replace a substring in the function below.
function linkOnClick(){
var anyNameYouLike = 'some sort of text/string right here';
anyNameYouLike.replace('right','in');
alert(anyNameYouLike)
}
它应该返回某种文本/字符串在这里",但不会.我究竟做错了什么?我对Java语言还很陌生(如果不太明显...)
It should return "some sort of text/string in here" but doesn't. What am I doing wrong? I'm fairly new with Javascript (if it isn't obvious...)
推荐答案
anyNameYouLike = anyNameYouLike.replace('right','in');
这篇关于Javascript replace()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文