I was recently going through javascript pure functions. I found out that the pure function should not have any global dependencies, so according to this i encountered a doubt which i have try to explain below.
function parent(){
const count =1;
const data = 30;
function child (){
let sum = count + data;
return sum;
}
function child2(count, data){
let final = count + data;
return final;
}
}
So according to the above snippet, can the child and child2 function be called as pure function? If child function is called as pure function they why because it is taking the parameters from the parent function defined above.
The output of both the functions will be same but which one would be called as pure function. This might be a very simple question but any help will be useful.
It's only about scope and variables