passing data in nested function

i’m a beginner in javascript and i tried to learn about function that called inside a function which redefine a value of a variable. Here’s the code

var a;

function app2(a) {
  var a = 8;
  return a
}

function app(a) {
  var a = 7;
  app2(a)
  return a
}
console.log(app(a));

when i run code, it still show 7 as the output. i thought it will be 8 because i’ve called the function app2 in the app function. why the value doesn’t change into 8? and what should i do update the variable value inside the nested function? thanks in advance