Hexlet doesn not really work properly in your browser, because it is pretty old.
Please, upgrade. Choose browser.


↳ Happy ticket

Intro to Programming

A happy ticket is a ticket with such a serial number that the sum of the first three digits is the same as the sume of the last three digits.

For example, ticket number 385916 is a happy ticket, since 3 + 8 + 5 = 9 + 1 + 6


Implement and export as default a function that verifies the happiness of a ticket. This function should return true if the ticket is happy, and false otherwise.

isHappyTicket(385916); // true
isHappyTicket(231002); // false
isHappyTicket(128722); // true


Convert a number to string using String like so:

String(1234); // "1234"

Convert a string back into a number using Number like so:

Number("456"); // 456

Use the length value to find out the length of a string:

'welcome'.length; // 7

Use the substr method to get a substring:

'foo'.substr(1, 2); // 'oo';
Start challenge Successful completion: 94%