• This comment is hidden because it contains spoiler information about the solution

  • This comment is hidden because it contains spoiler information about the solution

  • This comment is hidden because it contains spoiler information about the solution

  • I think sorting is too costly for this problem. Am I wrong?

  • This comment is hidden because it contains spoiler information about the solution

  • No reason behind. But Javascript does have a Issue with the sorting algorithm if revenue is the same. so we included it into the Testcases.

  • @fnbro why make up new fixed tests cases rather than use the same ones from the Python translation? There's no point in test suite disparity between the two languages.

  • Why are your tests different between JS and Python translations? The translations have different sets of fixed tests...

  • Yeah, that's strange... because I just ran my code in browser and it works great
    Don't know why it returns different arrays here and in my console...
    P.S. And my code works perfectly in Codepen too
    Thanks for the answer anyway, I guess I should just skip this kata..

  • My code returns [ "Tablets", "Music CDs", "Speakers" ]

    It doesn't, have you read the error message?

  • The question is same.
    My code returns [ "Tablets", "Music CDs", "Speakers" ].
    -Because Speakers goes BEFORE Keyboards.
    -In my answer Speakers goes BEFORE keyboards
    -This is their ORIGINAL positions.
    Why in the world would test expect KEYBOARDS?

  • "Speakers" goes before "Keyboards"

    expected [..., "Keyboards"] to deeply equal [..., "Speakers"]

    And what's the question? Your logic is correct, the only thing that's left is to make your code correct too.

  • So, I have these arguments in my JavaScript function:
    products: [ 'Tablets', 'Computer', 'Vacuum Cleaner', 'Mouses', 'Scooter', 'TVs', 'Speakers', 'Keyboards', 'Printer', 'Games', 'Chargers', 'Cell Phones', 'Music CDs', 'Drones' ]
    amounts: [ 40, 27, 12, 3, 12, 44, 22, 44, 17, 13, 1, 19, 22, 19 ]
    prices: [ 88, 66, 67, 63, 61, 6, 84, 42, 1, 22, 68, 72, 94, 24 ]
    And the test expected [ 'Tablets', 'Music CDs', 'Keyboards' ] to deeply equal [ 'Tablets', 'Music CDs', 'Speakers' ]
    Keyboards and Speakers has the same revenue: 1848, and you requested order them according to their original positions.
    Speakers goes before Keyboards in input parameters. So wtf does this thing want?

  • Will do :(. maybe i have to start all over again...

  • Loading more items...