Hello, if there are two arguments, what should it look like in terms of style code? Suppose such a transfer to another line? Or it should be one line, but then it comes out very long. Or maybe these arguments should be assigned to variables and work with them? Tell me please.

private isTest() { if ((this.argSorce.nativeElement.clientWidth < this.maxWidthBlock) || (this.argSorce.nativeElement.clientWidth < this.maxBlockContainer)) { } } 
  • I would use this.argSorce.nativeElement.clientWidth to const, however, if that is enough then 1 line if not, I would leave it as it is. - Dmitriy
  • By the way, internal brackets are not needed, comparison and so the priority is higher than that of "or". - Dimanoid
  • Thank you for your comments. In general, I did not find anything better - pridan

1 answer 1

If you want to read, it should be something like this:

  private isTest() { if ( this.argSorce.nativeElement.clientWidth < this.maxWidthBlock || this.argSorce.nativeElement.clientWidth < this.maxBlockContainer ) { } }