Hi Kartik, you're totally right that the new Date constructor introduces complexity that could potentially lead to impurity. But in this case, because of how Date works and the values we're passing in, we reasonably expect that every time we call this function, we will get the same output (i.e. it's deterministic). So for the purposes of this exercise, we can consider getWorkshopDate pure - although if e.g. someone went and changed the implementation of Date, such that calling it like this would not give a deterministic result, that could change! So your instinct that there's something a little weird here that could potentially make it impure is right :) Hope that helps!
Hello all. I had the same thought as Kartik. I even wrote for that on the FrontEndMasters discord server. Wouldn't be fair to say that a pure function doesn't depend on anything but it's enclosing scope variables and functionality. So when we talk about 'for the same input always the same output' I believe we should set some rules. First, if the input is something other than a literal value, let's say a variable that holds an object or some function, then we are not 100% sure that this reference won't change. Therefore a pure function's arguments have to be constant. They will never change. Then the function would definitely be predictable, unless we introduce some uncertainty inside the function(like a random number generator). And second, we should not introduce randomness inside the function. The calculation would be the same for every input. What do you think?