What is a "double point" [eg. 5..toFixed ()] I see in minified js?

I am working on a project where I need to deal with javacsript frameworks to work. We have a parser that reads them, but errors on lines with ... for example,

1..toPrecision()    

or

24..map(function(t){return 7..map(function(a){return e[a][t]})

He doesn't seem to understand "..", and neither do I. Why is this valid javascript? How does displaying a single number work? In the end, someone will fix the parser, but I'm looking for a temporary solution on how I can edit the miniature .js file to work. Is there any other way to write something like 24..map ()?

+4
source share
2 answers

- . , ?

console.log(1.2345); // for example
Hide result

, - , .

console.log(5.);
Hide result

, - . - .

console.log(5.                  .toString());
//           ^ decimal point    ^ property accessor
Hide result

:

DecimalIntegerLiteral. DecimalDigits opt ExponentPart opt ​​

opt .

+10

. - . 1. - .

. - . someNumber.toPrecision - .

:

1.0.toPrecision()
+4

Source: https://habr.com/ru/post/1673905/


All Articles