title: Uncaught SyntaxError: Unexpected token '{'
body: <blockquote>
    <p>The error is in the first line, i have been staring at it forever and cant find the problem.</p>
  </blockquote>
  
  <pre><code>bfs() {
      let result = []
      let queue = []
  
      queue.push(this.root)
  
      while(queue.length) {
        let currentNode = queue.shift()
  
        result.push(currentNode.value)
  
        if (currentNode.left) {
          queue.push(currentNode.left)
        }
        if (currentNode.right) {
          queue.push(currentNode.right)
        }
      }
  
      return result
    }
  }
  
  </code></pre>