Ad
Code
Diff
  • const isEven = n => !(n%2)
    • Number.prototype.evenOrOdd = function() {
    • return (['Even', 'Odd'][this%2])||'Not an integer'
    • }
    • const isEven = n => !(n%2)
Code
Diff
  • const power = (a, b) => a ** b
    • const power = (a, b) => a === 0 ? 1 : a ** b;
    • const power = (a, b) => a ** b
Code
Diff
  • const greetings = () => "My name is: seraph776"
    • const greetings = _ => "My name is: seraph776"
    • const greetings = () => "My name is: seraph776"
Code
Diff
  • const evenOrOdd = n => !(n%2)
    • const evenOrOdd = (number = prompt("Enter a number: ")) => `The number is ${number & 1 ? "even" : "odd"}.`;
    • const evenOrOdd = n => !(n%2)
Code
Diff
  • 1 // :/
    • 4
    • 1 // :/
Code
Diff
  • function revstr(str) {
      let revStr = str.split('').reverse();
      let rev = "";
      revStr.forEach(i=>{rev += i;});
      return rev;
    }
    • function revstr(str) {
    • i = str.length; newstr = "";
    • while (i > 0) {
    • newstr += str[i - 1]; i--;
    • }
    • return newstr;
    • let revStr = str.split('').reverse();
    • let rev = "";
    • revStr.forEach(i=>{rev += i;});
    • return rev;
    • }
Code
Diff
  • power = (p,n)=>{return p ** n}
    • power=(n,p)=> p === 0 ? 1 : Math.pow(n,p)
    • power = (p,n)=>{return p ** n}