检查对象是否大于另一个对象时使用哪种方法?我试图实现一个compareTo方法,但是它仅在比较Objects是否等于(=)时才使用。
例如
export class Check {
check: string;
}
export class Test {
constructor() {
const c1 = new Check(),
c1.check = '1-';
const c2 = new Check(),
c2.check = '1';
console.log(c1 < c2); // returns false but in my case it should be true because 1- is not as good as 1
}
}