D3: Confused by example in challenge "Set a Domain and a Range on a Scale"

In the Data Visualization with D3 challenge Set a Domain and a Range on a Scale there is this example code:

// Set a domain
// The domain covers the set of input values
scale.domain([50, 480]);
// Set a range
// The range covers the set of output values
scale.range([10, 500]);
scale(50) // Returns 10
scale(480) // Returns 500
scale(325) // Returns 323.37
scale(750) // Returns 807.67
d3.scaleLinear() /* <---- what is the purpose of this? */

What does the last d3.scaleLinear() do here? Elsewhere it’s used as scale = d3.scaleLinear(), but that’s not its purpose here.

I’m pretty sure that method just returns a function, so the function actually doesn’t do anything there… I think the example would be better if it was like this

const scale = d3.scaleLinear() /*<---- Here's that function call*/
// Set a domain
// The domain covers the set of input values
scale.domain([50, 480]);
// Set a range
// The range covers the set of output values
scale.range([10, 500]);
scale(50) // Returns 10
scale(480) // Returns 500
scale(325) // Returns 323.37
scale(750) // Returns 807.67

in the example it doesn’t really show what ‘scale’ is and that function call is a little misleading.

Thank you. I thought it might be a mistake, but I wasn’t 100% sure.