You need to sign in or sign up before continuing.×
Ad
  • Default User Avatar

    I have a similar problem but in this case both numbers ARE prime. I double checked.

    (6, 100, 110)

    101 is a prime number.

    101 + 6 = 107

    107 is also a prime number

    My function is returning [ 101, 107 ] (both prime numbers between 100 and 110 with an interval of 6).
    Still, the kata points an error "expected [ 101, 107 ] to deeply equal null".
    I dont understand :(

    Just figured it out. There can be no primes in between.
    Sorry

  • Custom User Avatar

    I think because in the sum prototype he gives an initial value of 0 in the reduce function. So if an empty array is passed that will be the default value

  • Default User Avatar

    361 isn't prime, it is evenly divisible by 19.

  • Custom User Avatar

    I think there is an issue in a test of JavaScript, correct me if im wrong.

    From this input(8, 300, 400) expected null to deeply equal [ 359, 367] /n
    But between 359 and 367 there is 361 that is prime. so... what i am missing? Is the only test of 100 that goes bad

  • Custom User Avatar

    I'm having the same issue, for some reason the console.log shows that [1, 2, 5] is being passed as the coinDenominations. Only when I console.log it with nothing else on the function does it show as [1,2,5,10,20,50]

  • Custom User Avatar

    "a" is the array, to know the length of the array to add the correct amounts of "0" - "y" wich is the index

  • Custom User Avatar

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

  • Custom User Avatar

    I don't get it, maybe is 'cause my inglish is not to good but i will share my doubts:
    In the array of example of the instructions

    [
    ["130/90","140/94"],
    ["160/110"],
    ["200/120"],
    ["150/94","140/90","120/90"],
    ["140/94","140/90","120/80","130/84"]
    ] 
    

    it says that # patients at index 0, 2, and 3 are hypertensive;
    why at index 3 and not also at index 4? it s because have to be the the last two elements of the array consecutive? I mean the 4th array have 140/94 and 140/90 but the last two tests of hypertension give 120/80 and 130/84 so in conclusion doesn't have hypertension? And if its like i interpret it i have to check only the last two test of the patient and all the other test are noise? I will gladly apreciate an answer. Have a good day/night

  • Custom User Avatar

    how this can be Best Practices?... i mean is clever for sure, but it is really dificult to read

  • Custom User Avatar

    Not an issue, it's only available in Node 14. or above

  • Custom User Avatar

    I flatten the array "by hand" and it works so the only problem was that. Maybe because and old version of node or what can may be?

  • Custom User Avatar

    Im in JS, when i run the tests it gives me a message saying: "arr.flat is not a function"... anyone knows why? because i run the same code in other plataform and it work just fine

  • Custom User Avatar
  • Custom User Avatar

    I have an issue... i run my code on RunJS and there all the test cases pass fine but when i copy the same code and run the test here not passes all of them and with a console.log i see that here it works really weird. How can i do to solve this?

    Here in this test case: coinsNeeded(123,[1,2,5,10,20,50]) the console.log shows me that only uses to reduce the amount by 5...
    but in my RunJS its reduced properly as shown in the sample test (50+50+20+2+1). I will copy my code here for you to test it in diferrent places but idk if its correct doing that here. So i wait for a response to try to solve my problem. Thank you and have a good day

  • Custom User Avatar

    Why the "+" at the start of the return makes the string into a number? and if i put a "-" instead of the plus symbol makes the negatives go positive and viceversa? I want to know how it works, if someone can explain me or send a link of MDN, i can't find it. Thanks

  • Loading more items...