0๐
โ
1 == true //true
1 === true // false
I think the problem may lies in the fact that HTTP returns true
, not 1
.
๐คazurinko
0๐
I think the โthisโ keyword has different value than you expected. Try this approach:
loadGame: function () {
let self = this;
this.$http.get('../api/games/ready/' + self.gameid).then(function (response) {
if (response.body === '1') {
var result = Math.floor((Math.random() * 2) + 1);
self.result = result;
}
});
}
๐คAvi Waserman
Source:stackexchange.com