so what you're trying to do is essentially impossible.
first of all, the reason why this prints input => Object.keys(input)[0] was not true is because you forgot to call your function! varName is a function here, and you concatenate it to a string in varName + ' was not true', and concatenating a string to a function returns the function source code.
here's the problem though: functions do not know what the parameter name is. in its current form you're trying to squeeze info out of a function that javascript doesn't know.
but you can (ab)use objects for this! you were already on the right track with Object.keys. for example, this works as intended:
function kv(obj) { return [Object.keys(obj)[0], Object.values(obj)[0]] }
let liar = false;
let soothsayer = true;
function tester(_input) {
let [varName, input] = kv(_input)
return input ? varName + ' was true' : varName + ' was not true';
}
console.log(tester({liar})); //> liar was not true
console.log(tester({soothsayer})); //> soothsayer was true
note that i called the tester function with tester({...}) instead of tester(...), because we need objects here. and {varname} is a shorthand for {varname: varname}, so this works!