Help with a code to calculate distance between 2 coordinates using Latitude and Longitude.

The text fields are just that - text , which means that they are NaN . You need to convert them to numbers. Something like this:

let lat1 = Number($w("#userLat"));