0

I'm trying to understand what was the goal of the below javascript(mini version) and how to rewrite in simple javascript which is easily understand by anyone.

Note: isAnimating can be any arbitrary function.

    next: function(){
     0 == this.$.animator.isAnimating() && this.inherited(arguments);
}
user1595858
  • 3,700
  • 15
  • 66
  • 109
  • @Bergi: I'm not sure we had enough information to mark as a dup. Looking at the function name, `isAnimating()` almost surely produces `true/false`, so what does the `0 == ` do? I think the OP may not have simplified the original js properly when asking the question. – Alvin Thompson Jun 22 '15 at 14:43
  • @AlvinThompson: It might be a crude way of writing a NOT operator (and should've been `!`)… maybe? If OP provides further information about that `isAnimating` thing, or [edit]s in other context, and asks further detailed questions, we may of course reopen the post. – Bergi Jun 22 '15 at 14:47
  • @Bergi: in any case, I'm not sure the referenced question is quite the same. – Alvin Thompson Jun 22 '15 at 14:51
  • I will edit with what 0 == does. – user1595858 Jun 22 '15 at 14:51
  • even better, why not post the original javascript? – Alvin Thompson Jun 22 '15 at 14:52
  • 1
    @user1595858: Without more information, I think whoever said that the `0 ==` construct is acting as a "not" before comments were deleted is right. So the answer would be `!this.isAnimating() && newFunc(arguments)`. – Alvin Thompson Jun 22 '15 at 15:02
  • Indeed, "*what `0 == ` does*" is simply a [comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Equality) with `0`. The question "*What does `0 ==` mean*" we cannot answer without more context, like at least a link to the complete script where you found this. – Bergi Jun 22 '15 at 15:54

0 Answers0