There are two ways you can use the information, the simplest to work with is to simply grab the next step, then throw away the path. This has the obvious downside that you waste a lot of resources by calculating the path the next frame again when you already knew:
var path = finder.findPath(player.x, player.y, 10, 10, grid)
player.x = path[1][0]
player.y = path[1][1]
path = null
The second, better option, is to store the path with the player
if (!player.path)
{
var path = finder.findPath(player.x, player.y, 10, 10, grid)
path.reverse() // To put the first steps last in the array so we can use pop
path.pop() // The first point in the array is the starting position
player.path = path
}
var step = player.path.pop()
if (step)
{
player.x = step[0]
player.y = step[1]
}
This code will move along the path to the destination, one step each time its called, the first time it calculates the path and then it reuses the existing path until the destination has been reached. To change where the player is going simply set a new path, or clear the existing one.