SORU
16 ŞUBAT 2011, ÇARŞAMBA


Nasıl bir dizi JavaScript tek olup olmadığını belirlemek için

Eğer JavaScript çift veya tek bir sayı olup olmadığını belirlemek için bazı kod için beni işaret edebilir?

CEVAP
16 ŞUBAT 2011, ÇARŞAMBA


function isOdd(num) { return num % 2;}
console.log("1 is odd "   isOdd(1) == true);
console.log("2 is odd "   isOdd(2) == false);
console.log("3 is odd "   isOdd(3) == true);
console.log("4 is odd "   isOdd(4) == false);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Google Developers

    Google Devel

    23 AĞUSTOS 2007
  • Kiddyzuzaa

    Kiddyzuzaa

    25 ŞUBAT 2014
  • SRT Photoshop Tutorials

    SRT Photosho

    19 Aralık 2012