Confused with function syntax and constructor syntax


#1

So i've just finished the course, however after reading a little bit i am very confused because the way we are taught to write functions is:

var x = function() {

}

However i'm now seeing people write functions like this:

function doThis() {

}

The thing is in the objects section the way we would write a constructor is also the same way:

function Constructor() {

}

Maybe i've totally confused myself, but how does this work for both? is a constructor just a function to create a new instance of a object?

Thanks in advanced!


#2

What you ought to be looking into is

Function expressions vs. Function declarations

Read more on this HERE