Perform metric calculations with JavaScript.