Loading

膜拜了,javascript水好深啊

请将All over the world people enjoy sports替换成All1 over2 the3 world4 people5 enjoy6 sports7

 

 

 

 

 

 

 

大牛的实现:

 

 

var i = 0, str = "All over the world people enjoy sports";
str = str.replace(/\S+/g, function($){return $ + [++i]});
alert(str);

posted @ 2012-04-12 16:46  青岛欧姆网络科技  阅读(237)  评论(0编辑  收藏  举报