• 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 :\

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

  • Fixed this too.

  • 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?

  • Fixed this one.

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

  • arr[i] seems to be null there.

  • 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?

  • 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.

  • 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


  • 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?

  • There is kinda of a limit, as there are not algorithms that currrently existed out there for nxn larger than 7

  • Hi ya creator of "Magic Squares" quiz, I am quite new to programming in JavaScript and Codewars was wondering if you knew of any way for me to test for

    [[9, 14, null],[8, 10, 12],[13, 6, 11]]
    [[9, 14],[8, 10, 12],[13, 6, 11]]
    [null,[8, 10, 12],[13, 6, 11]]

    as well as for [null] and [undefined]. Is any possibility of us collaborating or a way to PM you?