Sabtu, 24 Desember 2016

How to add reference to function object in Javascript

In JavaScript functions are objects. So, variables that reference them can be treated as object references. Example for function definition and function call is given below: 1 2 3 4 5 6 7 8 9 10 //Function Definition function  add(x, y) {     return x+y; } //Function Call addref = add;  //Here addref is a reference to the add(function) object add(10, 20); addref(20, 30);  //This is also valid In JavaScript, a function definition must occur before a function call. So, it is wise to define a function in the head section of the page. The scope of a variable denotes the

The post How to add reference to function object in Javascript appeared first on Coding Security.


How to add reference to function object in Javascript
read more

Tidak ada komentar:

Posting Komentar