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

  • Influencer Plus

    Influencer P

    2 Ocak 2013
  • Leigh Momii

    Leigh Momii

    10 Mayıs 2006
  • RFS Dan

    RFS Dan

    22 Temmuz 2014