map & forEach
let logs = `2018-05-23 20:24:09,876 [Timer-2] ERROR org.gil.sydb.server.table.sync.LocalSynchronizer [] - Fetch Error Sync List Failure
java.sql.SQLException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294)
`;
// let logs = json.data;
logs = logs.replace(/\t/ig, ``).split(`
`);
logs.forEach(item => item.trim());
// copy(logs);
logs.forEach(
item => {
console.log(`item =`, item);
console.log(`item.trim() =`, item.trim());
return item.trim();
}
);
logs = logs.map(
item => {
console.log(`item =`, item);
console.log(`item.trim() =`, item.trim());
return item.trim();
}
);
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!