I am new to javascript. I am drawing the lines which are connected to each other with an array given by user(input). The array will be 2d or 3d. This answer is perfectly working