Drill

ProblemsTypeScript › logistics

Is this address complete enough to ship

easylogisticsTypeScript

The checkout refuses street-level addresses without a door number. A record has the street name and a number field that may be empty.

addressValid(street: string, doorNumber: int) → bool

Solve it in the editor →

Where you start

function addressValid(street: string, doorNumber: number): boolean {
  
}

Worked examples

CallResult
addressValid("Bagdat Cad no 12", 12)true
addressValid(" ", 5)false
addressValid("Kumsal Sok", 0)false
addressValid("", 12)false

Hint

Trim the street, then check the number.

Reference solution in TypeScript
function addressValid(street: string, doorNumber: number): boolean {
  return street.trim().length > 0 && doorNumber > 0;
}

The same problem in another language

More logistics problems in TypeScript