Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var numbers = [5, 7];
function calculate(operation) {
  return operation(this.numbers[0], this.numbers[1]);
}
function add(number1, number2) {
  return number1 + number2;
}
console.log(calculate(add));
(function() {
  var localScope = {
    numbers: [15, 21]
  };
  console.log(calculate.call(localScope, add));
})();
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers