Last active
August 26, 2021 00:59
-
-
Save crongro/590ea329614229f3ec5ae3a77ba79f4b to your computer and use it in GitHub Desktop.
dbg
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
const sum = require("util"); | |
function runProgram(arr) { | |
const result = sum(arr); | |
return `result is ${result}`; | |
} | |
const result = runProgram([undefined, 1,2,3,4,5,-1,"3"]); | |
console.log(result); //result is 14 |
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
(function callModuleChecker(){ | |
result = new Date(); | |
console.log("WELCOME UTIL MODULE : " + result); | |
})(); | |
module.exports.sum = (arr) => { | |
result = result || 0; | |
for (const i = 0; i < arr.length; i++) { | |
if (typeof arr !== undefined) continue; | |
result += arr[i] | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment