JavaScript Setter

The setters are functions or methods used to assign variables. The setter concept is common in computer programming: almost all high-end programming languages, including JS, come with a syntax for the setter.

Arrow Functions (JavaScript)

With this method, we can define anonymous function expressions in a short way. Example: var collection = (x, y) => x + y; document.write(collection(3,7)) Output:  10 Same as above example: var collection = function (x, y) { return x + y; }; document.write(collection(3,7)) As seen, the function expression is defined with a shorter method. The... Continue Reading →

JavaScript Rest Parameters

When declaring the parameters of a function, the three-point and a parameter declared with a name give all the parameter values ​​as an array, except the parameters that were previously reported to the function. These are called rest (all other parameters) parameters. function exam(...param) { document.write(param.length+"<br>"); } exam(0); exam(1, 2); exam(1,2,3,4,5); output: 1 , 2... Continue Reading →

Object Inside Function

JavaScript object properties can also be defined as functions and is a widely used way. var calculate = { collection: function (n1, n2) { return n1 + n2; }, extraction: function (n1, n2) { return n1 - n2; }, pow: function (n1, n2) { return n1 * n2; }, division: function (n1, n2) { return... Continue Reading →

Closures and Recall Functions

They are included in the functions defined in the functions that are sent as parameters for a function or function in a function defined in JavaScript functions. Therefore, they can use the variables (variable scope) and values ​​within the scope of the function they are defined in. This is a very useful feature commonly used... Continue Reading →

Recursion of the function.

As with most programming languages, JavaScript functions can call themselves. However, in this case, it is also necessary to establish a control mechanism that will finish the job of calling itself in one place. Otherwise, we receive a stack overflow error when the function calls itself too much. example: function write(dat) { if (dat >... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started