This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var test=[50,30,null]; | |
var sum = test.reduce(add,0); | |
function add(total, num) { | |
return total+num; | |
} | |
console.log(sum); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var syslog = '<14>1 2016-08-07T03:25:39.198284+00:00 loggregator 765a363b-3467-436c-3d69-6b6789533456 [APP/0] - - 7 Aug 03:25:39 - [error] [function:faf0b791.050f48] This is an error from noderedapp'; | |
var regSys = /<(\d+)>(\d{1})\s{1}(\S+)\s{1}(\S+)\s{1}(\S+)\s{1}(\S+)\s{1}-\s{1}-\s{1}.+-\s{1}\[(\S+)\]\s{1}\[(\S+)\]\s{1}(.+)/; | |
var breakdown = regSys.exec(syslog); | |
console.log(typeof regSys); | |
console.log(breakdown); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parseFloat(parseFloat("2039.43485").toFixed(2)); | |