我在有重复部分的 CMS 中使用这段代码。在本节中,我可以添加一个将重复的值。但我希望最后一个重复的项目被去掉逗号。有人可以建议如何从最后一个重复的项目中删除逗号。首先十分感谢!
<script type="text/javascript">
$("#gallery").click(function(e){
e.preventDefault();
$.swipebox([
// begin repeating area/section - in this example 4 items are repeated
{href:'[%MEDIA_URL%]', title:'[%TITLE%]'},
{href:'[%MEDIA_URL%]', title:'[%TITLE%]'},
{href:'[%MEDIA_URL%]', title:'[%TITLE%]'},
{href:'[%MEDIA_URL%]', title:'[%TITLE%]'}, //this comma needs to be removed
// end repeating area/section
]);
//some code here to remove the last comma from the array ???
});
</script>