Program to find the Magnitude of a Vector | Function to calculate magnitude of a 3 dimensional vector ; Stores the sum of squares of coordinates of a vector ; Return the magnitude ; Driver Code
function vectorMagnitude ( x , y , z ) { var sum = x * x + y * y + z * z ; return Math . sqrt ( sum ) ; } var x = 1 ; var y = 2 ; var z = 3 ; document . write ( vectorMagnitude ( x , y , z ) ) ;