var math_it_up = {
'+': function (x, y) { return x + y },
'-': function (x, y) { return x - y }
};
math_it_up['+'](1, 2) == 3;
More Related Contents:
- How do I pass command line arguments to a Node.js program?
- Call child method from parent
- How can you check for a #hash in a URL using JavaScript?
- Persist javascript variables across pages? [duplicate]
- Add a “hook” to all AJAX requests on a page
- Is JavaScript a pass-by-reference or pass-by-value language?
- Resolve circular references from JSON object
- Change CSS of selected text using Javascript
- Why should y.innerHTML = x.innerHTML; be avoided?
- TypeError: Illegal Invocation on console.log.apply
- How to support promises in Internet Explorer 11?
- How to determine whether an object has a given property in JavaScript
- Performance differences between visibility:hidden and display:none
- How do I check in JavaScript if a value exists at a certain array index?
- Are any JavaScript engines tail call (TCO) optimized?
- fetch() unexpected end of input
- How can I construct a Template String from a regular string? [duplicate]
- break array of objects into separate arrays based on a property
- What is the difference between const and const {} in JavaScript
- D3.js – Donut charts with multiple rings
- Simulate the ‘new’ operator in JavaScript
- Recursively filter array of objects
- Validate html text input as it’s typed
- How to show live preview in a small popup of linked page on mouse over on link?
- How can I sum properties from two objects?
- Ajax – 500 Internal Server Error
- Find closest date in array with JavaScript
- How to render clipped surfaces as solid objects
- How to check if two vars have the same reference?
- XMLHttpRequest: Network Error 0x80070005, Access is denied on Microsoft Edge (but not IE)