What does this syntax mean?
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.
Apparently, it always returns this, but what is in brackets is the so-called side effect. Third party action.
Very similar to code compressed via terser.js or something similar.
If you expand it a little, it will look like this:
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;
Well, the comma operator Vadim has already given a linkAnonymous
To place the code, please use CodePen or similar tool. Thanks you!