Facebook
From amir, 1 Month ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 133
  1. function compareNumbers(arr) {
  2.     if (arr.length < 2) {
  3.         return "The array does not have enough elements.";
  4.     }
  5.  
  6.      let comparis
  7.     if (arr[0] > arr[1]) {
  8.         comparisonResult = "greater";
  9.     } else if (arr[0] < arr[1]) {
  10.          comparis
  11.     } else {
  12.          comparis
  13.     }
  14.  
  15.      if (comparis "equal") {
  16.         return "Both numbers are equal.";
  17.     }
  18.  
  19.     return `${arr[0]} is ${comparisonResult} than ${arr[1]}`;
  20. }
  21.  
  22.