Adding text to beginning of each array element

前端 未结 7 1407
[愿得一人]
[愿得一人] 2020-11-30 06:49

I have an array which contains the contents as follows:

[\"ZS125-48ATab\", \"STR125YBTab\", \"KS125-24Tab\", \"ZS125-50Tab\", \"DFE125-8ATab\", \"ZS125-30Tab         


        
相关标签:
7条回答
  • 2020-11-30 07:17

    The following code would do the job:

    var t = ["ZS125-48ATab", "STR125YBTab", "KS125-24Tab", "ZS125-50Tab", "DFE125-8ATab", "ZS125-30Tab", "HT125-8Tab", "HT125-4FTab", "STR50Tab"];
    
        for(var i=0;i<t.length;i++){
            t[i] = "#"+t[i];   
        }    
    

    See demo here

    0 讨论(0)
提交回复
热议问题