Toggle Widget Visibility with Dropdown?

I feel like this has probably already been answered, but from searching I dont fully understand the responses given so far. is it possible to change a widgets visibility & interactivity with a value from a dropdown? if so what would be the best approach to do so.

Im guessing something like if value == 0 set @widgetid visibility true, but im not 100% on the syntax or where exactly im supposed to enter that.

2 options:

Using advanced syntaxes (docs)

Writing this in the visibility property;

JS{

if (@{dropdown_id} === 0) {
  return false
} else {
  return true
}

}

Using scripting and custom variables (docs)

By writing VAR{visible, true} in the visibility property (creates a custom variable named "visible" with default value true) and controlling this variable from the dropdown's onValue script:

if (value === 0) {
  setVar('widget_id', 'visible', false)
} else {
  setVar('widget_id', 'visible', true)
}

Thank you, that not only provides me with a solution but gives me a much deeper grasp of how and where I can utilise script & Advanced Syntax