21 Nisan 2014 Pazartesi

Javascript 'If Else' Arka Planda Nasıl Çalışır

Javascript kökeninde else if mantığı ile çalışmaz:
Eğer şu şekilde bir kod yazmış iseniz:

if ( msj === 'slm' ) { console.log('Merhaba'); } else if ( msj === 'Hi' ) {
console.log('Hello'); }
javascrip bu kodu arka planda şu şekilde çalıştıracaktır:

if ( msg === 'Slm' ) { console.log('Merhaba'); } else { if ( msg === 'Hi' ) { console.log('Hello'); }
} 

0 yorum:

Yorum Gönder