October 2018
Intermediate to advanced
590 pages
15h 5m
English
A function in JavaScript is quite different from a method in Java because it is actually an object created by the Function constructor, which is a built-in object of the language. Yes, that's right. Function itself is an object too. What is a method in JavaScript, then? When a function is a property of an object, it is a method. So, in JavaScript, a method is a function, but not all functions are methods.
Since a function is an object, it can also have properties and methods. To establish whether an object is a function or not, you can use instanceof, as follows:
var workout = function () {};console.log(workout instanceof Function); // true
What is the difference between a function and other objects in JavaScript, apart ...
Read now
Unlock full access