Skip to content

Instantly share code, notes, and snippets.

@wulymammoth
Created April 19, 2020 23:59
Show Gist options
  • Save wulymammoth/0621404d75cb718c484d107c413f9994 to your computer and use it in GitHub Desktop.
Save wulymammoth/0621404d75cb718c484d107c413f9994 to your computer and use it in GitHub Desktop.
function add(a, b) {
return a + b;
}
const cases = [
// [a, b], expectedAnswer
[[1, 2], 3], // 3
[[5, 5], 10],// 10
[[-1, 2], 1], // 1
[[1, 1], 2]
];
cases.forEach((c, index) => {
const [args, expected] = c;
let [a, b] = args;
console.log(`case # ${index + 1}`)
console.log(add(a, b) === expected)
})
module.exports = add;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment