SOURCE

                       var mfMetalLayer = null;
                       var subLayers = '1+2+3+4'; //根据+拆分,然后求和,如1+1+1+1,这里显示4
                       if(subLayers.indexOf('+')>0){
                          mfMetalLayer = 0;
                          var subLayersArry = subLayers.split('+');
                          for(let i in subLayersArry){
                              mfMetalLayer += parseInt(subLayersArry[i]);
                          }
                          mfMetalLayer = mfMetalLayer.toString();
                       }else{
                          mfMetalLayer = subLayers;
                       }
                       console.log(mfMetalLayer);



var s = "1,2,3";
var arr = s.split(",");
console.log(arr);

s = "1";
arr = s.split(",");
console.log(arr);
console 命令行工具 X clear

                    
>
console