Ad
Code
Diff
  • function evenOrOdd(n) {  // here n takes input
      return (n % 2 == 0) ? 'Even' // if number remainder is 0 then even
      : (n !=  parseInt(n)) ? 'Not an integer' // if n is not a integer then not an integer
      : 'Odd' // else odd
    }
    • Number.prototype.evenOrOdd = function() {
    • return (['Even', 'Odd'][this%2])||'Not an integer'
    • function evenOrOdd(n) { // here n takes input
    • return (n % 2 == 0) ? 'Even' // if number remainder is 0 then even
    • : (n != parseInt(n)) ? 'Not an integer' // if n is not a integer then not an integer
    • : 'Odd' // else odd
    • }
Code
Diff
  • for (let a = 6; a < 16; a++) {
      console.log("Matthew is gay");
    }
    • var b = 5;
    • var a = 6;
    • do {
    • for (let a = 6; a < 16; a++) {
    • console.log("Matthew is gay");
    • a++;
    • } while(a<16);
    • }