Why is this site introducing functions like this?


#1

//This is how I expect functions to work

function greet (name) 
{
    console.log("Great to see you," + " " + name);
}

But this tutorial is representing it like this, by throwing
the name into a variable, which I haven't seen any language
do before

var greeting = function (name) {
    console.log("Great to see you," + " " + name);
};

Why????????????????????


#2


You can use both in JS. Maybe one picked this version as it has some causality, meaning you cannot call a function before it is introduced.