Skip to content

JavaScript minifier breaks with "(number).method()"-Syntax

Given simple JavaScript code such as this: (2).pow(2)

The minifier strips the first brackets from the code, resulting in this invalid code: 2.pow(2)

SyntaxError: identifier starts immediately after numeric literal

Here's a proper usecase that would also break upon minification:

function round(num, dec) { return Math.round(num * (10).pow(dec)) / (10).pow(dec); }

Edited by David
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information