How to set variable which I pass to a function
function checkSetName(inputVar, outputVar, txt){
if (inputVar.length) {
outputVar = txt + ': ' + inputVar.val();
} else {
outputVar = "";
}
}
checkSetName(name, nameTxt, 'Hello world ');
I pass the empty variable nameTxt and I expect it to be set the value inside of function, but after function executes the variable is undefined
How to set variable that I pass to a function in JavaScript