xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

map & forEach

map & forEach

image


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 发布文章使用:只允许注册用户才可以访问!


posted @ 2018-05-24 15:40  xgqfrms  阅读(33)  评论(0编辑  收藏  举报