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 addRandomGreeting() {
  const greetings =
      ['I am 18 years old', 'My favorite color is purple.', 'I play the violin', 'I love desserts.'];
  const greeting = greetings[Math.floor(Math.random() * greetings.length)];
  const greetingContainer = document.getElementById('greeting-container');
  greetingContainer.innerText = greeting;
}
function addRandomGreeting ( ) { const greetings = [ 'I am 18 years old' , 'My favorite color is purple.' , 'I play the violin' , 'I love desserts.' ] ; const greeting = greetings [ Math . floor ( Math . random ( ) * greetings . length ) ] ; const greetingContainer = document . getElementById ( 'greeting-container' ) ; greetingContainer . innerText = greeting ; }
Adds a random greeting to the page.
Adds a random greeting to the page .
// Pick a random greeting. // Add it to the page.