I am trying to implement the Smith-Waterman local alignment algorithm in JavaScript but am not well versed in the language. Below is my code to construct the alignment matrix: