I´m trying to interpret source codes from big platforms like Facebook to learn how great programmers do their work, some of them have a type of programming that I have been never seen before. This loop is inside that type of programming:
for (var e; b.length && (e = b.shift()); ) b.length || void 0 === c ? d = d[e] ? d[e] : d[e] = {
}
This is the first time I see something like this, I finally thought that this slice of code was only created for distracting and scare possible malicious users
- The loop starts with an undefined variable called 'e'
for (var e;...
- And it has no condition to running it, it do nothing, no sense.
b.length && (e = b.shift());
This code means: number of elements inside b and e equals b without the first element
- the third loop statement is also empty, there is no increment.
- Now the hardcore part, there is no action for every recursion, not even Braces {}
b.length || void 0 === c ? d = d[e] ? d[e] : d[e] = { }
This code means: number of elements inside b or if undefined equals the content inside the variable c and if d equals the element number e inside d, then do nothing and if not then element number e inside d equals an empty braces {}
As you can see, this code has no sense, it has no reason to exist, but it does, so, Can an expert tell me if this is actually works for something or its just ascii symbols with no utility?