Recursive power function - JS Bin// source http://jsbin.com/jekivuwogu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function highPass(number, cutoff){
cutoff = cutoff || this.cutoff;
return (number >= cutoff);
}
var filter1 = {
highPass: highPass,
cutoff: 5
},
filter2 = {
cutoff: 3
};
var res = highPass(3, 6);
console.log(res);
var res1 = filter1.highPass(3);
console.log(res1);
var res2 = highPass.call(filter2, 5);
console.log(res2);
</script>
<script id="jsbin-source-javascript" type="text/javascript">function highPass(number, cutoff){
cutoff = cutoff || this.cutoff;
return (number >= cutoff);
}
var filter1 = {
highPass: highPass,
cutoff: 5
},
filter2 = {
cutoff: 3
};
var res = highPass(3, 6);
console.log(res);
var res1 = filter1.highPass(3);
console.log(res1);
var res2 = highPass.call(filter2, 5);
console.log(res2);</script></body>
</html>
function highPass(number, cutoff){
cutoff = cutoff || this.cutoff;
return (number >= cutoff);
}
var filter1 = {
highPass: highPass,
cutoff: 5
},
filter2 = {
cutoff: 3
};
var res = highPass(3, 6);
console.log(res);
var res1 = filter1.highPass(3);
console.log(res1);
var res2 = highPass.call(filter2, 5);
console.log(res2);