Finding Closure in Chrome developer tools

November 12, 2017

Chrome is amazing, and provides closure scope variable for a better debugging experience.

In console with the following codes, the obj function returns an object with a closure. Without developer tool, we don’t know what exactly the closure is for either setI or getI, but after logging the returning object, Chrome gives us a [[Scopes]] referencing object for both setI and getI, with the Closure obj of i.

let obj = function() {
  let i = 0

  return {
    setI(k) {
      i = k

    getI() {
      return i

let x = obj()


Closure in Chrome

Tagged withjavascript, closure

Questions, Comments, Suggestions? Open an Issue