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

  • ☆ SUB4SUB CENTER! ☆ spam here

    ☆ SUB4SUB

    22 ŞUBAT 2010
  • Defence Videos

    Defence Vide

    13 Mayıs 2013
  • Need for Speed

    Need for Spe

    8 ŞUBAT 2006