Area of a Polygon in JavaScript

Calculate the area of non-self-intersecting polygons.

A tiny JavaScript function (103 bytes) calculates the area of a simple, non-self-intersecting polygon. Please note that the calculation is wrong if the polygon is self-intersecting.

This page requires JavaScript.

Reload this page for an other random example.

Created by Thiemo Mättig in January 2012 for Inspired by areaTriangle by @neizod. Thanks to @tsaniel for saving 1 byte.

Show the source of this page or visit the Gist at GitHub.