map & forEach
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\njava.sql.SQLException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)\n\tat org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294)\n`;
// let logs = json.data;
logs = logs.replace(/\\t/ig, ``).split(`\n`);
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 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/9083207.html
未经授权禁止转载,违者必究!