Javascript -What happens if a variable and a function have the same name? : <p>Might be a kind of easy question, but I have a question on the issue of having the same name for a variable and a function.</p>

<p>If there's a variable,</p>

<pre><code>var add = 1;
</code></pre>

<p>and a function,</p>

<pre><code>function add(x,y) {return x+y;}
</code></pre>

<p>and there're two console.log,</p>

<pre><code>console.log(add)
console.log(add(1,2))
</code></pre>

<p>I've expected those 2 console.log would work properly since add contains the Number and add() is classified as a Function, but the second one prints an error. So they aren't considered the same.</p>

<p>But the result says I'm wrong.
Can anyone explain what's going on in my code?</p>
