Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 228 Bytes

closures.md

File metadata and controls

17 lines (15 loc) · 228 Bytes

Closures

let app = (function(){
  let car = 123
  let getId = function(){
    return car;
  }
  return {
    getId: getId,
    car: car
  }
})();

console.log(app.getId()) // 123
console.log(app.car) // 123