Javascript Concat Array If Not Undefined Slope Formula For A Line