Is there API for getting area (superficial measure) of polygon

hi~
i wanna know is there API to get area of polygon, or best way to calculate in javascript
thank you