Función Inside Object JavaScript
var obj = {
func: function(a, b) {
return a * b;
}
};
obj.func(3, 6); // 18
TC5550
var obj = {
func: function(a, b) {
return a * b;
}
};
obj.func(3, 6); // 18
// Function declaration.
function showFavoriteIceCream() {
const favIceCream = 'chocolate';
console.log(`My favorite ice cream is ${favIceCream}`);
}
// Let's assign a property.
showFavoriteIceCream.flavours = ['chocolate', 'vanilla', 'strawberry'];
// Let's log the showFavoriteIceCream function.
console.log(showFavoriteIceCream);
// Log
// { [Function: showFavoriteIceCream]
// flavours: [ 'chocolate', 'vanilla', 'strawberry' ] } -> property assigned