Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 从数组中的值框中删除逗号_Node.js - Fatal编程技术网

Node.js 从数组中的值框中删除逗号

Node.js 从数组中的值框中删除逗号,node.js,Node.js,Nodejs:如何删除数组中value参数中的逗号 [[ '000150607',42439,'F16','605661','CO.,LTD'][ '0001502607',424329,'Fg16','6095661','DCO.LTD'][ '00002607',4249,'16','60995661','DCO.,LTD']] 我想删除逗号形式的CO.LTD,比如=>CO.LTD 如何做到这一点 只需循环子数组值并使用replace var数组=[ [000150607',42439'

Nodejs:如何删除数组中value参数中的逗号

[[ '000150607',42439,'F16','605661','CO.,LTD'][ '0001502607',424329,'Fg16','6095661','DCO.LTD'][ '00002607',4249,'16','60995661','DCO.,LTD']]
我想删除逗号形式的CO.LTD,比如=>CO.LTD
如何做到这一点

只需循环子数组值并使用
replace

var数组=[
[000150607',42439',F16',605661',CO.,LTD'],
[0001502607',424329',Fg16',6095661',DCO.LTD'],
[00002607',4249',16',60995661',DCO.,LTD']
];
console.log(数组);
对于(var i=0;i
您可以使用JavaScript数组的
.map()
方法

let arr = [
    [ '000150607',42439,'F16','605661','CO.,LTD'],
    [ '0001502607',424329,'Fg16','6095661','DCO.LTD'],
    [ '00002607',4249,'16','60995661','DCO.,LTD']
];

var withoutComma = arr.map((singleArray) => {
    return singleArray.map((singleValue) => {
        return typeof singleValue === 'string' ? singleValue.replace(',', '') : singleValue;
    });
});

console.log(withoutComma);