Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Javascript: Trying to make text randomly generate

let sentenceArray = [
  "Fun fact about me, I love video games, I have been playing video games since I was 10 years old",
  "I want to be a front end developer because creating and the building is a passion of mine",
  "You should really look at the projects I built, you can get a good look at my skillsets"
];

const el = document.querySelector(".speech-bubble p");

setInterval(() => {
  const random = Math.floor(Math.random() * sentenceArray.length);
  el.innerText = sentenceArray[random];
}, 2000);
<!DOCTYPE html>
<html>

<head>
    <title>Parcel Sandbox</title>
    <meta charset="UTF-8" />
</head>

<body>
    <div class = "speech-bubble">
        <p>Hi there, as you can see I am Sheldon Aldridge</p>
    </div>
</div>
</body>

</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript assigning index number to row in table 
Javascript :: Angular /Javascript- How can I shrink Sticky header on scroll functionality 
Javascript :: How to escape specific JSON characters in Powershell 
Javascript :: -1 in js 
Javascript :: angularjs GetVideos API, Cant get the key parameter inside the array 
Javascript :: Why is the return function in my debounce function never called? Angularjs 
Javascript :: angularjs Re-evalute expressions when page reloads via history 
Javascript :: AngularJS w/Prerender 404 error on home page 
Javascript :: Fire "data-ng-change" programatically or another way to change value of input on website using Angular JS 
Javascript :: Angularjs onchange datetime picker not working 
Javascript :: How can change the display of the product images on the PDP? Spartacus 
Javascript :: How to query a button with specific text with react native testing library 
Javascript :: react table Maximum update depth exceeded. 
Javascript :: RegEx Pattern Validations failing on html input 
Javascript :: gradient of a function 
Javascript :: JOLT split flat object into key/value array 
Javascript :: vscode search shortcut 
Javascript :: Alternative Bind() Syntax For JavaScript 
Javascript :: json array form to list object java 
Javascript :: javascript assignment by reference or value 
Javascript :: Using <template in Javascript to create a form 
Javascript :: javascript find prime numbers 
Javascript :: javascript quotes 
Javascript :: react console logs not working 
Javascript :: Declare Function To Be Used In Class 
Javascript :: square brackets javascript object key 
Javascript :: prevent the Confirm Form Resubmission dialog | window.history.back() confirm form resubmission 
Javascript :: leetcode solution problem 66 plus one 
Javascript :: how to set javascript load order in html 
Javascript :: React Futures - Server Components 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =