first of all thanks for the replay. 
I'm quite new to javascript and I'm learning by doing. Probably I totally misunderstand js logic some where.
Anyway, probably I'll share the wrong request hoping it should solve my issue.
Coming back to the issue as it was at the beginning.
Let's say that I have a var like this
    var filteredMedia =nest1.filter(function(d) {
  return d.key == brand_sel})[0]
where brand_sel must be updated both on page load and on change. 
brand_sel is the value of the selected option of a dropdown.
using this code
    function update() {
   var brand_sel = d3.select("#brand").node().value
  return brand_sel;
}
var brand_sel = update();
console.log(update())
everything works on page load.
Now I'm trying to run update function also on change in the following way but of course I'm still missing to understand somthing
d3.select('select').on("change", function(){
  update();
});