I am learning JavaScript and I don't understand style of writting JS code which I read. I know "old" way but I didn't found manual where is explained this style of create and calling JS function. "New way":
// object
var dog = {
color: 'brown',
size: 'big'
};
//function to write dog size
(function(dog) {
return dog.size;
})(dog);
From JavaScript manual I know (old way):
function prinSize(dog) {
return dog.size
}
console.log(prinSize(dog));
Please could send me a link to JS doc, where is explained why
in JS code are on start and end of function brackets
why is possible after declare of function write brackets with .(dog) and with this you actually call the function with argument dog.