0

is this code outrageously wrong, its supposed to visit each address in the array and tell if theres a ping response

var a="167.192" function address(){ for(x=0;x<255;x++){ for(y=0;y<255;j++){ document.write(a+"."+x+"."+y } } return= addresses } var addresses [ /* do i really have to copy and paste all those addresses in this array or can i just put either the previous functions name or its return? */ ] var b= 0 while(b<array.length){ window.location= address().return }

21st Jul 2017, 2:34 AM
Escobar
Escobar - avatar
3 Respostas
+ 1
The first time you write a variable in javascript, you always need to include "var". You may need to do it again if the variable is only defined within a certain function/loop but you want to use a variable of the same name again outside of the function/loop. In your code, just add var to the loops: for (var x = 0; x < 255; x++) //note: x will only exist within the loop
29th Jul 2017, 12:27 AM
James
James - avatar
0
your second for loop increments j instead of y. Also can you declared var x and y?
21st Jul 2017, 3:07 AM
Ari
Ari - avatar
0
o, lol the j was a typo...and x and y ecist as zeros, do they not?
23rd Jul 2017, 3:44 AM
Escobar
Escobar - avatar