Calculates the Euclidean distance between two points in a 2D space.
The x-coordinate of the first point.
The y-coordinate of the first point.
The x-coordinate of the second point.
The y-coordinate of the second point.
The distance between the two points.
// ES Moduleimport { distance } from '@bnidev/js-utils'// CommonJSconst { distance } = require('@bnidev/js-utils') Copy
// ES Moduleimport { distance } from '@bnidev/js-utils'// CommonJSconst { distance } = require('@bnidev/js-utils')
const dist = distance(0, 0, 3, 4) // dist will be 5 Copy
const dist = distance(0, 0, 3, 4) // dist will be 5
Calculates the Euclidean distance between two points in a 2D space.