facg3 / GameOfThrones

0 stars 1 forks source link

splitting the condition. #31

Open abdhalees opened 6 years ago

abdhalees commented 6 years ago

If you need the two conditions to be true to execute a block, and one of them don't have an else condition, you will save lines and blocks by writing them in the same condition.

if(xhr.readyState == 4){
        if(xhr.status == 200){ 

is similar to

if(xhr.readyState == 4 && xhr.status == 200){

https://github.com/facg3/OurCoolApp/blob/5f70af466012300571b4a3fed87acb4697be4e74/front-end/js/index.js#L70