How can I pass the variable word1 in the first function to the second function in pure JavaScript?
function functionOne()
{
var word1 = "dog" ;
}
function functionTwo()
{
var word2= word1;
}
I’ve checked the other questions in stackoverflow on this subject but I didn’t get a simple answer.
Creating common variable as below resolve your issue