Ad

If input is number - returns it,
else returns zero.

Code
Diff
  • const returnInputNumber = (n = 0) => {
      return typeof n === "number" ? n : 0;
    };
    • const returnInputNumber = n => n
    • const returnInputNumber = (n = 0) => {
    • return typeof n === "number" ? n : 0;
    • };
Code
Diff
  • const helloWorld = (name) => `Hello, ${name}.`;
    
    • const helloWorld = n => ('Hello ' + n)
    • const helloWorld = (name) => `Hello, ${name}.`;