How to subtract one array of numbers from another?

  • 0
    var array = [5,3,7]
    var array2 = [1,2,4]


    You need to get in result: `[4,1,3]`

    What is the easiest way to do this?
    JavaScript Finn Park, Mar 28, 2020

  • 1 Answers
  • 0
    var result = array.map ((v, i) = & gt; v - array2 [i]);
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!