How to exchange display order in a diagram by using javascript?

Such as : there are tow or more sheaps in the diagram,they have to cover eatch other,I want to use javascript to exchange their display order at the z-axis.
how to do this?

Please read http://gojs.net/latest/intro/layers.html.