Kod
last_height=heights[i++]=i<9|last_height<screen_width&Math.random()<.3?screen_width:Math.random()*unit+70|0;
=
Kod
if( i<9|last_height<screen_width&Math.random()<.3 ){
last_height=screen_width;
} else {
last_height=Math.random()*unit+70|0;
}
Teraz do tego:
https://developer.mozilla.org/en-US/docs/Ja...ator_PrecedenceDodatkowo:
- zapis coś|0 służy do wyeliminowania takich przypadków:
Kod
<script>
alert( null +" - "+ (null | 0) );
alert( undefined +" - "+ (undefined | 0) );
</script>
- zapis last_height=heights[i++]= służy do zapisanie tego samego w dwóch zmiennych na raz. Czyli np. a=b=2; w wyniku będzie a=2 i b=2;
Resztę musisz przemyśleć samemu. Już wiesz o co chodzi w zapisie, pozostaje zrozumienie tego, czego nie chciałbym robić samemu, ze względu na mój czas.
Pozdrawiam