Uncaught TypeError: .. is not a function in javascript
<p>I am trying to use d3.js to draw line chart.</p>

<h2>Javascript</h2>

<pre><code>function lineChart(){
    ...
}

function update(){
    ...
    var lineChart = lineChart()
        .x(d3.scale.linear().domain([2011, 2014]))
        .y(d3.scale.linear().domain([0, 1000000]));
    ...
}
</code></pre>

<p>But the console says that <code>Uncaught TypeError: lineChart is not a function</code>.<br>
How to fix this?</p>