This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Data types | |
Variables | |
Type conversion | |
Operators (unary, binary, string concatenation ('+' operator), numeric conversion ('+' operator)) | |
Logical operators | |
Conditional operators (if, ?) | |
Loops ('while', 'for') | |
Switch | |
Variable scoping, hoisting | |
Let, var, const |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const polygonArea = (ps) => { | |
const v = ps.reduce( | |
(acc, p, i) => (acc += p.x * ps.at(i - 1).y - ps.at(i - 1).x * p.y), | |
0 | |
); | |
return Math.abs(v) / 2; | |
}; | |
// or |