MCPcopy Create free account
hub / github.com/codemistic/Web-Development / newQuote

Function newQuote

Quote-generator/script.js:28–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26// Get Qutotes From API
27
28function newQuote() {
29 loading();
30 const quote = apiQuotes[Math.floor(Math.random() * apiQuotes.length)];
31 // console.log(quote);
32
33
34 // check if Author field is blank and replace it with 'Unknown'
35 if (!quote.author){
36 authorText.textContent = 'Unknown';
37 } else {
38 authorText.textContent = quote.author;
39 }
40 // Check Quote length to determine styling
41 if (quote.text.length > 50) {
42 quoteText.classList.add('long-quote');
43 } else {
44 quoteText.classList.remove('long-quote');
45 }
46 quoteText.textContent = quote.text;
47 complete();
48}
49
50async function getQuotes(){
51 loading();

Callers 1

getQuotesFunction · 0.85

Calls 3

loadingFunction · 0.85
completeFunction · 0.85
removeMethod · 0.80

Tested by

no test coverage detected