Nhảy tới nội dung

Function là object

Function trong JavaScript là object. Do đó, bạn có thể gắn property cho function.

js
function hello() {
return "Hello World";
}
 
hello.prop = 123;
js
function hello() {
return "Hello World";
}
 
hello.prop = 123;