To entitle a defendant to any setoff he or she may have against the plaintiff, he or she must allege the same in his or her answer; and the statutes regulating setoffs in the superior court, shall in all respects be applicable to a setoff in a justice's court, if the amount claimed to be setoff, after deducting the amount found due to the plaintiff, be within the jurisdiction of the justice of the peace; judgment may, in like manner, be rendered by the justice in favor of the defendant, for the balance found due the plaintiff.