sample math functions in JavaScript