I have a problem with Sync function in FS core of nodejs. for example I have a nodejs file with this syntax
var y;
fs.accessSync("real_exixs_path", fs.R_OK | fs.W_OK, function(err) {
  if (err) {
    console.log("File error!");
  } else {
    y = "foo";
  }
});
after running this code the global "y" variable still remain undefined and it won't set to "foo". Can someone help me?