This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var box = null; | |
| console.log(box); | |
| // result: null | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var box; | |
| console.log(box); | |
| // result: undefined | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| * Actions | |
| */ | |
| function showList(event) { | |
| var theList = document.getElementById('the-list'); | |
| theList.className = 'dropdown-list showing'; | |
| } | |
| function hideList(event) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| * Actions | |
| */ | |
| function showList(event) { | |
| var theList = document.getElementById('the-list'); | |
| theList.className = 'dropdown-list shown'; | |
| } | |
| function hideList(event) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var theList = document.getElementById('the-list'); | |
| console.log( theList.className ); | |
| // 'dropdown-list shown' | |
| theList.className = 'dropdown-list hidden'; | |
| // hiding the list | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var theList = document.getElementById('the-list'); | |
| var firstItem = theList.firstElementChild; | |
| console.log( firstItem.textContent ); | |
| // 'The rose is red' | |
| firstItem.textContent = 'The flower is dancing'; | |
| // changing content | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var theList = document.getElementById('the-list'); | |
| console.log(theList); | |
| // the dropdown list element | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var body = document.body; | |
| // start traveling from <body> | |
| var html = body.parentElement; | |
| // its parent is <html> | |
| var head = body.previousSiblingElement; | |
| // its previous sibling is <head> | |
| var dropdown = body.firstElementChild; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var head = document.head; | |
| console.log(head); | |
| // an object models the element <head> | |
| var body = document.body; | |
| console.log(body); | |
| // an object models the element <body> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | .dropdown { | |
| font-family: Arial, sans-serif; | |
| font-size: 16px; | |
| display: inline-block; | |
| position: relative; | |
| } | |
| .dropdown-btn { | |
| font-size: 14px; | 
NewerOlder