Data Structures - Create a Trie Search Tree

just a quicky (i think) if you scroll to the bottom of the code (probably just glance at the rest).
The first log is outputting the result of the subsequent .add() method. i was expecting an empty data set here.
what am i missing?

SORRY - UPDATE: it’s doing as i describe in my VScode editor/browser, not in the fcc editor.

var displayTree = tree => console.log(JSON.stringify(tree, null, 2));
var Node = function() {
this.keys = new Map();
this.end = false;
this.setEnd = function() {
  this.end = true;
};
this.isEnd = function() {
  return this.end;
};
};
class Trie {
// Only change code below this line
constructor(){
  this.root = new Node()
}

add(word){
  let currentNode = this.root;
  for(let i=0; i<word.length; i++){
    let charToInsert = word[i]
      if (Object.keys(currentNode.keys).includes(charToInsert)) {
        currentNode = currentNode.keys[charToInsert]
      }else{
    //}
     if(word[i+1]){
      currentNode.keys.set(charToInsert, word[i+1])
    }else{currentNode.keys.set(charToInsert)}
    let newNode = new Node()
      newNode.keys.set(word[i+1])
      currentNode.keys[word[i]] = newNode
      currentNode = currentNode.keys[word[i]]
    }
  }
    currentNode.setEnd()
  }
// Only change code above this line
};

let tree = new Trie()
console.log(tree) //I DON'T KNOW WHY THIS DISPLAYS END RESULT
tree.add('buu')
displayTree(tree)
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36

Challenge: Data Structures - Create a Trie Search Tree

Link to the challenge:

anyone know why it would be doing that in the browser tho?