+ 3
Hi Guys what's going on here? :) HOW IS THIS WORKING?
(function (days) { days[days["SUN"] = 0] = "SUN"; days[days["MON"] = 1] = "MON"; days[days["TUE"] = 2] = "TUE"; days[days["WED"] = 3] = "WED"; days[days["THU"] = 4] = "THU"; days[days["FRI"] = 5] = "FRI"; days[days["SAT"] = 6] = "SAT"; })(days || (days = {}));
1 Resposta
+ 3
These types of functions are called Immediately Invoked Function Expressions.
It has one argument called days - It could be the value user passed or an empty object by default.
And the things inside the function are some arrays representing days. They can be viewed simply as below.
days[0] = "SUN" OR days["SUN"] = "SUN".
That is the content that we get if we get this js in a human readable form.
I hope this helped you.