javascript matrix calulator