no, that would be a variable assignment. such as:
Code:
var someName = "Christopher";
the following is a function declaration:
Code:
function myFirstFunction() {
//some code here
} Variables are used to store data, such as your name or the number 16. Functions just grouped lines of code that do something, such as a hypothetical function below:
Code:
function displayHelloWorld() {
var someData = "Hello World!";
document.write(someData);
} That's actually a function within a function. The function I created is called displayHelloWorld, which merely creates a variable and assigns data to it. Then the document.write function (standard in javascript) takes that data and displays it on the screen. I believe in your website you use console.log instead, as it prints to the console instead.
Remember that the equals sign (=) is merely an
assignment operator. It assigns data to a variable. Functions don't store data, they only execute blocks of code.
I would recommend checking out the link I sent you, as it should help you learn the basics of Javascript. Then I would try doing these exercises.
EDIT: I am not familiar with the variable assignment of a function. I did some research on it. I'm not sure it's exactly a beginner friendly topic. However, I will try to explain. (Source:
http://stackoverflow.com/questions/3...n-functionname)
When you declare a function like this:
Code:
var someFunction = function() {
//somecode
} it's only understood by the computer at run-time. so if you make a call to someFunction before it is defined, it will generate an error. However, if you define a function as I mentioned above, it is understood by the computer at parse-time, which means when the computer reads it.
Visit the link for more information.