Split Bash String Into Array Javascript Iteration Method