I’ve made an experiment in JavaScript:
var x=[ "1","2","3","4","5","6"];
c=(b = x)[2] ; //<--- what is this syntax?
alert(b ); // 1,2,3,4,5,6
alert(c ); // 3
I figured it out how it works. It saves me a line of equalization. Still, I was wondering about this strange syntax. How is it called and where can I read about it?
=operator returns a value being assigned so(b = x)returns value ofx. That results inx[2]being assigned toc.(note: “returns
x” changed to “returns value ofx” according to comments)