Skip to content

Instantly share code, notes, and snippets.

@crongro
Last active January 4, 2017 05:10
Show Gist options
  • Save crongro/d38c4c0a75b54a75150ceb5448c4f318 to your computer and use it in GitHub Desktop.
Save crongro/d38c4c0a75b54a75150ceb5448c4f318 to your computer and use it in GitHub Desktop.
bugcode
function checkargs(a,b,type) {
var checkResult;
if(typeof a !== type || typeof b !== type) return false;
else return;
}
function multiplyDouble(num2,num2) {
var DOUBLE = 2;
var sum = num1 * num2 * 2;
var result = sum * DOUBLE;
return result;
}
function calculate(num1,num2, func) {
if(!checkargs(num1,num2,"number")) return "not number..";
if(typeof func !=== "function") return "not function..";
var result = fn(num1,num2);
console.log("result is ", result);
}
calculate(10,3,multiplyDouble);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment