Observe array in javascript