What does this syntax mean?

  • 0
    There is a code like this
    return this.len += (this.tail = this.tail.next = new f((t >>>= 0) < 128 ? 1 : t < 16384 ? 2 : t < 2097152 ? 3 : t < 268435456 ? 4 : 5,t)).len,
                    this

    This is the body of the function, how to understand "return number, this"?
    Thank you in advance for your help, if the answer is obvious please send it to the dock.
    Is it some kind of syntactic sugar?
    JavaScript Anonymous, Mar 28, 2020

  • 2 Answers
  • 0
    Apparently, it always returns this, but what is in brackets is the so-called side effect. Third party action.

    Tyk
    Anonymous

  • 0
    Very similar to code compressed via terser.js or something similar.

    If you expand it a little, it will look like this:
    let a;
    t >>>= 0;
    if(t < 128) a = 1;
    else if(t < 16384) a = 2;
    else if(t < 2097152) a = 3;
    else if(t < 268435456) a = 4;
    else a = 5;
    this.tail.next = new f(a, t);
    this.tail = this.tail.next;
    this.len += this.tail.len;
    return this;


    Well, the comma operator Vadim has already given a link
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!