我不明白为什么 if-else 构造不起作用。
const Diagnostics = require('Diagnostics');
const Reactive = require('Reactive');
var num = 5;
var firstCondition= false;
var secondCondition = false;
function func(){
firstCondition = Reactive.ge(num, 10);
secondCondition = Reactive.lt(num, 10);
if(firstCondition){ //false
num = 0;
} else if(secondCondition){ //true
num = 1;
}
}
func();
Diagnostics.watch("num - ", num);
Diagnostics.watch("firstCondition ", firstCondition);
Diagnostics.watch("secondCondition ", secondCondition);
num 显示 0:( 我做错了什么?它是特定于反应式编程的吗?