How to make this javascript code using a matrix work with App Inventor to count matrix inversions?

Thanks to @TIMAI2 , the javascript solution is part of :wink:

"