My Quote Machine functions

Hello guys, I’ve been working on my quote machine for 2 days, and I thought that I would finish it soon after managing to the quote button, but after trying a variable from a function to another function to make another button work, it made me stuck and now I have no idea what can I do since I’m still new with javascript.

I want to know how can I make the var b from function 1 to work in function 2.

Here’s my copdepen : https://codepen.io/jvincent3/pen/EWVEeZ

What you’ll want to do is call function2 inside of function1 and pass the variable as a parameter.

function1() {
    var someVar = "Hello";
    function2(someVar);
}

function2(word) {
    console.log(word + ", world!");
}
1 Like

Thanks a lot, but I fixed it already, I got help from FCC discord.

I don’t know how to close the thread.