我有一個地址并想更改一些元素,我的地址在下面:var address = "http://20.0.1.8/x-manufacturer/senders/d7aa5a30-681d-4e72-92fb-f0ba0f6f4c3e/sample-data";我想將var地址“sample=data”的最后一個索引的內容更改為“new-data”,我寫了下面的代碼來解決它,但沒有給我我需要的東西!let array_address = address.split('/');var new address = array_address.splice(0,9,"new-data");//It just remove last index,didn't replace.
如何更改數組中最后一個索引的內容?
狐的傳說
2022-06-09 19:01:02