I'm currently trying something in Node JS where I want a function with a callback to update a variable name and then I will log out the variable name. Below describes what I am trying to acheive
var testVariable = "first"
functionWithCallbackWhichPopulatesTestVariableWithWordSecond(callback)
Print testVariable
In the above scenario when testVariable is output it is outputting "first" but I want it to be "second" as the callback function that is passed in should change it to "second".
Hopefully that makes sense. I'm not sure I have explained it the best but would really appreciate some help with this.
Thanks.