The following code is from Mike Bostock's Force-Directed Graph with Mouseover. I am sorry that I can't ask a more pointed question about this code, but I was wondering if someone could explain the syntax in the forEach block that computes the distinct nodes from the links.
What exactly is happening in the line below and what is being assigned to what variables? Is there a name for performing multiple assignments in the same expression?
link.source = nodes[link.source] || (nodes[link.source] = {name: link.source});
var links = [
{source: "Ericsson", target: "ZTE", type: "suit"},
{source: "Kodak", target: "Samsung", type: "resolved"},
{source: "Apple", target: "Samsung", type: "suit"},
{source: "Kodak", target: "RIM", type: "suit"},
{source: "Nokia", target: "Qualcomm", type: "suit"}
];
var nodes = {};
// Compute the distinct nodes from the links.
links.forEach(function(link) {
link.source = nodes[link.source] || (nodes[link.source] = {name: link.source});
link.target = nodes[link.target] || (nodes[link.target] = {name: link.target});
});