Given the definition:
A pure function is a function which given the same input, will always return the same output and produces no side effects.
Can we consider function AmIPure as pure function? According to definition no, but I want to make sure.
function Amount(value, currency) {
this.value = value;
this.currency = currency;
}
function AmIPure(value, currency) {
return new Amount(value, currency);
}
var foo = AmIPure(5, "SEK");
var baz = AmIPure(5, "SEK");
console.log(foo === baz); //false