I have a question about ux:Property and Javascript

<Panel ux:Class="SelectTest">
  <float ux:Property="Selected" />
  <JavaScript>
    console.log("selected index is " + this.Selected.value);
  </JavaScript>
</Panel>
<JavaScript>
var Observable = require("FuseJS/Observable");
 var selectedindex = Observable(5);
 module.exports = {
  selectedindex: selectedindex
 }
</JavaScript>
<SelectTest Selected="{selectedindex}" />

I think selected index is 5 should appear.
but, selected index is 0 appears.

Why is not assigning {selectedinedx} to Selected?

That happens because you’re accessing the property imperatively. The properties are derived Observables, meaning that you can only access them using reactive operators.

The value in derived Observables is not available synchronously, and your console.log() runs before the value is populated. If you did the following, you should be alright:

this.Selected.inner().onValueChanged(module, function(x) {
    console.log("selected index is " + x);
});

Note the use of .inner() there - that may or may not be necessary, because it appears that you’re passing an Observable to the property. Since properties are implicitly available as Observables, you might end up with an Observable inside of another Observable.