+ 4

Help with a Code

https://code.sololearn.com/WggcUTYYPif0/?ref=app In this Code I'm trying to make a genetic algorithm. In JSANYWHERE it works just fine but in SoloLearn not ... why pls help.

4th Sep 2018, 9:40 AM
Anton Böhler
Anton Böhler - avatar
2 Answers
+ 4
For JavaScript DOM access codes that init run from JS pane, is required to be callbacked by window.onload function due to codes of JS pane are executed in head tag before DOM elements are loaded. var c; // declare global var here window.onload = function() { // put your init code here // access var e.g. c global var }
4th Sep 2018, 9:54 AM
CalviŐČ
CalviŐČ - avatar
+ 2
thanks very much!
4th Sep 2018, 10:01 AM
Anton Böhler
Anton Böhler - avatar