Changed the for loop in slave.js and master.js

Changed the for....in loop with normal for loop in slave.js and master.js. Some more instances left in master.js.
Also you can replace the `i -= 1` with `i--` or `i++` if you decide to loop from start to end.