this.uncomfortable.operator.value가 2로 나눈 값의 정수부분이 짝수일 경우 그 값을 보여주고 홀수일 경우 0을 보이라고 하면


result = parseInt(this.uncomfortable.operator.value / 2) % 2 == 0 ? parseInt(this.uncomfortable.operator.value / 2) : 0


똑같은 긴 변수를 2번이나 입력해줘야 한다.


아니면


x = parseInt(this.uncomfortable.operator.value / 2)

result = x % 2 == 0 ? x : 0


이렇게 2줄을 쓸 수도 있고.


result = parseInt(this.uncomfortable.operator.value / 2).lambda(x => x % 2 == 0 else 0)


이런 메서드가 있으면 세상이 조금은 더 달콤해질 것 같다.



이상 중증 급성 강박증 환자의 잡언이었다.