(+(("lastIndexOf") in []) ** 55 + 2) + 5 
  • Is it about priorities? - Hovhannes Shaxulyan

1 answer 1

In many languages, such as PHP and Python and others, there is an exponentiation operator (usually ^ or ** ), the operator is defined to have higher priority than unary operators such as unary + and unary - , but there are a few exceptions. For example, in Bash, the operator ** created with a priority lower than that of unary operators. It is impossible to write a two-meaning expression in JavaScript, i.e. you cannot put a unary operator ( +/-/~/!/delete/void/typeof ) immediately before the base number.

Taken from here

In other words: this is a limitation of js — you cannot use a unary operator before a base number (a number that is raised to a power) because of its “ambiguity”.

Options for correction.

Explicitly indicate the procedure:
((+(("lastIndexOf") in [])) ** 55 + 2) + 5

Use the old method:
(Math.pow(+("lastIndexOf" in []), 55) + 2) + 5

  • Curiously, but here unary plus is higher than erection. Where is the confusion then? - user207618 6:42 pm
  • @Other, really entertaining, there is a reason to delve into this unknown and semi-working es7 ... - MedvedevDev
  • @Other, everything turned out to be simpler than it seemed, it was enough just to open the English version and see the word "base", the priority had nothing to do with it, this is just a limitation (although what is still unclear about it). - MedvedevDev
  • @Other, like they changed their minds there, because of what they decided to ban. But I thought it was just a minus. - Qwertiy
  • @Qwertiy, what changed your mind? - user207618 7:49 pm