portfolio/src/main/webapp/script.js
/**
 * Adds a random greeting to the page.
 */
Adds a random greeting to the page.
Adds a random greeting to the page .
function addRandomFact() {
  const greetings =
      ['Hello world!', '¡Hola Mundo!', '你好，世界！', 'Bonjour le monde!'];
  const facts = 
      ['I cannot swallow pills' , 'I do not know how to ride a bike', 'I have 2 dogs', 'I have watched every episode of Gossip Girl at least four times.', 'I was hungry as I was typing these facts.']
  const fact = facts[Math.floor(Math.random() * facts.length)];
  const factContainer = document.getElementById('fact-container');
  factContainer.innerText = fact;
}
function addRandomFact ( ) { const greetings = [ 'Hello world!' , '¡Hola Mundo!', 你好，世界！', 'Bonjour le onde!']; const facts = [ 'I cannot swallow pills' , 'I do not know how to ride a bike' , 'I have 2 dogs' , 'I have watched every episode of Gossip Girl at least four times.' , 'I was hungry as I was typing these facts.' ] const fact = facts [ Math . floor ( Math . random ( ) * facts . length ) ] ; const factContainer = document . getElementById ( 'fact-container' ) ; factContainer . innerText = fact ; }
Adds a random greeting to the page.
Adds a random greeting to the page .
// Pick a random fact. // Add it to the page.