Ad
  • Custom User Avatar
    • the description only states "handle them", but not "how" we should handle them
    • this is a good example of useless artifical edge cases
  • Custom User Avatar

    check the array for contains undefined or null and return false?) as the description says?)

  • Custom User Avatar

    What should I do when the value in array is null or undefined?
    If I throw the error I failed the test.

  • Default User Avatar
  • Custom User Avatar

    I don't understand?? These aren't magic squares?? magic squares add up to 15 columns, rows, and diagonals.
    As per your example, you say that: [[9, 14, 7],[8, 10, 12],[13, 6, 11]]) // should return true ... but the last row equals 30? is this correct?

    Sorry for my stupidity :\

  • Custom User Avatar

    If arr[i] is null, null[0] (or arr[i][0]) will throw the error you saw.

  • Custom User Avatar

    Fixed this too.

  • Default User Avatar

    Thank you! but why doesn't it work by checking like this (arr[i][j]==null) but it does like this arr[i]==null, doesn't it make more sense to check element by element?

  • Custom User Avatar

    Fixed this one.

  • Custom User Avatar

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

  • Custom User Avatar

    arr[i] seems to be null there.

  • Default User Avatar

    Cannot read property '0' of null

    I'm probably missing something but I'm checking if(arr[i][j]==null || arr[i][j]==undefined) and I also check if the length is 0, but I still get this error "Cannot read property '0' of null", but it checks green "Test Passed: Value == false" what could the issue be?

  • Custom User Avatar

    You should add tests where the rows and columns add to a number and the diagonals not (you could simply swap two rows or two columns of a right solution, first with second or second with third, not first with third because the value would be the same). I've made some code that passes the current tests and didn't even checked the diagonals.

  • Custom User Avatar

    It's be nice to include 4x4 examples so the user doesn't have to find any on the web. For example:

    magicSquare([[4, 9, 6, 15],[14, 7, 12, 1],[11, 2, 13, 8],[5, 16, 3, 10]]); //true
    magicSquare([[4, 9, 6, 15],[14, 7, 12, 1],[12, 2, 13, 8],[5, 16, 3, 10]]); //false

    Cheers!

  • Custom User Avatar

    I don't think there is a way to PM anyone, so I was wondering if I can do a translation for your kata, as coincidently I am producing a similar kata to your own, or vice versa perhap?

  • Loading more items...