Templater: how to define variable via suggester dropdown?

I’m a newbie at both Templater and JavaScript, so could someone please tell me why the following code doesn’t work for defining a variable?

<%*
var thing = false;
await tp.system.suggester(["Yes", "No"], [thing = true, thing = false], false, "Thing?");
-%>

It always gives false.

I also tried the following, but that throws a Template syntax error: Unexpected token 'var':

<%*
var thing = false;
await tp.system.suggester(["Yes", "No"], [var thing = true, var thing = false], false, "Thing?");
-%>

(Using var bc I need to use these variables in if statements in other parts of the note, and from what I understand, let doesn’t allow this.)

Try this

<%*
let thing = false;
await tp.system.suggester(["Yes", "No"], [true, false], false, "Thing?");
-%>

Thanks, but I’m still getting false, and I don’t understand how just returning true or false without tying it to the variable would update its value.

Managed to figure it out :tada:

<%*
var thing = await tp.system.suggester(["Yes", "No"], [true, false], false, "Thing?" );
-%>