The function is:
(function (x,y) {return x+y})('foo')
I am learning javascript.
I do not know what this sentence mean. It seems to be a function. However, when I use it as
foo(1,2)
It gives errors. could anyone tell me what that sentence means? is it a function or just a wrong statement? If it is a function, how can I use it? Or it is
There is a similar function from a demo of facebook API, which is
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
I don't understand this code. Is it a function which takes document, 'script', 'facebook-jssdk'
as input? if it is, what is the function name?
Thanks!