Unable to implement trie data structure

Tell us what’s happening:
I am confused about how to add and how to keep track of individual words.
And whether my isWord method is what it’s supposed to be.

Your code so far


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;
};
};
var Trie = function() {
// Only change code below this line
this.node = new Node();
this.add = function(word){
  for(var i = 0; i < word.length; i++){
    this.node.keys[word[i]] = word[i];
  }
  this.node.setEnd();
  
}

this.isWord = function(word){
  for(var i = 0; i < word.length; i++){
  if(this.node.keys[word[i]]){
    return console.log(true);
  }else{
    return console.log(false);
  }
  }
}

this.print = function(){
  var array;
  
  console.log(this.node.keys);
}
// Only change code above this line
};
let trie = new Trie();
trie.add("sanad");
trie.isWord("a");
trie.print();

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0.

Challenge: Create a Trie Search Tree

Link to the challenge: