Created
          November 5, 2018 16:20 
        
      - 
      
 - 
        
Save ohiosveryown/1aa63da70660d325b15a695c545c40b4 to your computer and use it in GitHub Desktop.  
    Single Random Entry from Array
  
        
  
    
      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
    
  
  
    
  | const h1 = document.querySelector('h1') | |
| const pages = [ | |
| '<a target="_blank" href="http://google.com">Google</a>', | |
| '<a target="_blank" href="http://apple.com">Apple</a>', | |
| '<a target="_blank" href="http://nike.com">Nike</a>', | |
| '<a target="_blank" href="http://adidas.com">Adidas</a>', | |
| ] | |
| const page = pages[~~(Math.random() * pages.length)] | |
| // const page = pages[pages.length * Math.random() | 0] | |
| h1.innerHTML = page | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment