A-Star pathfinder for a Canvas sprite using javascript?

I am trying to make a 2d game using javascript Canvas, but I need the sprites to be able to navigate around the map using AStar (or something similar). I’ve tried researching a bit into this, but I can’t manage to understand how to do what I want. I need the pathfinding function to return the path as a list of consecutive coordinates to go towards in order to get to the target tile.
Would someone be able to make a function (or point me in the direction of one) that would do something like this:

var map =
  [
    [0, 0, 1, 0, 1],
    [1, 0, 1, 0, 0],
    [0, 0, 0, 1, 0],
    [0, 1, 0, 0, 1],
    [0, 0, 1, 1, 1],
    [1, 0, 0, 0, 1]
  ]
var currentPos = [0, 0];
var targetPos = [5, 3];

function pathFind(map, start, end) {
 // Coding Stuff......
}

listOfMovesToMake = pathFind(map, currentPos, targetPos);
// returns array of coordinates
// i.e. [ [0, 1], [1, 1], [2, 1], [2, 0], [3, 0], [4, 0], [4, 1], [5, 1], [5, 2] ]

I like the concept of pathfinding, but the math and brain power required is painful.
Thanks to anybody that can help.