Not able to get the javascript ".length" output into a variable
<p>I am using d3.js to load a csv file using d3.csv and store it in 'List'. When I assign the List.length value to a variable (totalElems), the value always comes to 0. However, the List.length does return the actual size of the array. Where am I going wrong ?
N.B: 
I am using chrome console for this exercise with python HTTP server
Attached along-with is a screenshot of the error.
<a href="https://i.stack.imgur.com/cGvPh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cGvPh.png" alt="Screenshot of the error"></a></p>