Powershell While Loop Array Javascript Iteration