Javascript basics

1) Javascript classes and object oriented programming basics:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes,

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript

 

 

2) JS functions: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions

The parameters of a function call are the function’s arguments. Arguments are passed to functions by value.

If the function changes the value of an argument, this change is not reflected globally or in the calling function.

However, object references are values, too, and they are special: if the function changes the referred object’s properties, that change is visible outside the function.

 

The this keyword does not refer to the currently executing function, so you must refer to Function objects by name, even within the function body.

 

var multiply = function func_name(x, y) {
   return x * y;
};

There is a distinction between the function name and the variable the function is assigned to.

The function name cannot be changed, while the variable the function is assigned to can be reassigned.

The function name can be used only within the function’s body.

Attempting to use it outside the function’s body results in an error (or undefined if the function name was previously declared via a var statement).

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s