I’ve worked with C# for many years but I’m pretty inexperienced when it comes to javascript so this should be an easy pick for any of you javascript wizards. I was looking through a JQuery plugin for managing cookies (https://github.com/carhartl/jquery-cookie) when I saw these two lines:
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
I just want to make sure I understand this correctly; is this the equivalent of:
var days = options.expires;
options.expires = new Date();
var t = options.expires;
t.setDate(t.getDate() + days);
I imagine this is an attempt to compress the code as much as possible but I admit I get confused when thinking about what the value of the variables are. Especially since options.expires can be either a javascript date object or a number of days.
Yes. The return value of an assignment is the value that was assigned.