且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用jquery / javascript替换字符串中的最后一个字符?

更新时间:2022-11-16 17:21:33





您可以使用Splice方法删除最后一个对象。

将您的东西存储为数组,找到索引您删除并使用拼接方法的元素。



Hi,

You can use Splice method to remove the last object.
Store your stuff as an array, find the index of the element which you wana delete and use splice method over it.

var arrayMy=[1,2,3,4];
var x=arrayMy.indexOf(4);
arrayMy.Splice(x,1);





希望它有所帮助。



-Anurag



hope it helps.

-Anurag






您可以使用Splice方法删除最后一个对象。

将您的东西存储为数组,找到您删除的元素的索引并使用拼接方法。



Hi,

You can use Splice method to remove the last object.
Store your stuff as an array, find the index of the element which you wana delete and use splice method over it.

var arrayMy=[1,2,3,4];
var x=arrayMy.indexOf(4);
arrayMy.Splice(x,1);





希望它有所帮助。



-Anurag



hope it helps.

-Anurag