Could someone tell me how to write the below in an "object-literal" fashion..
my.item('apple').suffix("is awesome")
// console.log >> apple is awesome
My attempt ... but it obviously doesn't work.
var my = {
item:function(item){
my.item.suffix = function(suffix){
console.log(item, suffix);
}
}
};
(Sorry if the title is wrong. I'm not sure of the terminology)
Try this: