Javascript hoisting simple function [duplicate]

How come a gets logged and b doesn’t? Is a somehow appended to the global scope, while b remains within hoist() scope?

function hoist() {
  a = 20;
  var b = 100;
}

hoist();

console.log(a);
// Output: 20

console.log(b);
// Output: ReferenceError: b is not defined