Creating a loop to create traces in javascript

I need help on figuring out how to create a loop that will create traces for me. I have an array and need to create as many traces as there are elements in the array. The array can change therefore I can not hard code it

Here’s an example: http://codepen.io/etpinard/pen/pbQAQK?editors=0010