I created a function called add
.
function add(a,b){
return a + b;
}
add.val = 10;
console.log(add) // => function add()
console.log(add.val) // => 10
I’d like to know how and why it is possible to create the val
property on add
. Why do we only see the output as function when add
also has val
on it?