Click here to Skip to main content
15,881,248 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: unexpected result function autocomplete() Jquery Pin
Richard Deeming21-Nov-18 8:16
mveRichard Deeming21-Nov-18 8:16 
GeneralRe: unexpected result function autocomplete() Jquery Pin
serenimus22-Nov-18 6:11
serenimus22-Nov-18 6:11 
GeneralRe: unexpected result function autocomplete() Jquery Pin
serenimus22-Nov-18 6:13
serenimus22-Nov-18 6:13 
GeneralRe: unexpected result function autocomplete() Jquery Pin
Richard Deeming22-Nov-18 8:41
mveRichard Deeming22-Nov-18 8:41 
GeneralRe: unexpected result function autocomplete() Jquery Pin
serenimus1-Dec-18 0:19
serenimus1-Dec-18 0:19 
QuestionHello Pin
Member 1406106620-Nov-18 8:15
Member 1406106620-Nov-18 8:15 
QuestionJavascript help Pin
ghazabaz8-Nov-18 15:54
ghazabaz8-Nov-18 15:54 
AnswerRe: Javascript help Pin
Richard Deeming9-Nov-18 3:49
mveRichard Deeming9-Nov-18 3:49 
ghazabaz wrote:
insert a function named randomint

ghazabaz wrote:
function randomlnt(

You might want to start by using the name you were told to use. There's a difference between a lower-case I and a lower-case L. Smile | :)

ghazabaz wrote:
Use those two parameter values and the Math.floor() and Math.random() methods to return a random integer within the specified range.

Your function doesn't return anything. And it completely ignores the size parameter.

ghazabaz wrote:
Math.random(0-9)

That passes a single argument of -9 to the Math.random function. But that function doesn't take any parameters, so it's ignored.
Math.random() - JavaScript | MDN[^]

ghazabaz wrote:
randomlnt(Math.random(0-9));

Your function expects two parameters. You are only passing one parameter. You are also throwing away the value that your function isn't returning yet.

ghazabaz wrote:
var randomQ = randomlnt;

That stores the function in the variable randomQ. Your instructions were to store the return value in that variable.

ghazabaz wrote:
getQuote(randomQ); {
document.getElementByTagName("quoteElem").innerHTML = quoteElem;
}

That throws away the return value of the getQuote function. It then tries to set the innerHTML of every <quote> element in the document to the first quote element, which isn't going to work.

You need something more like:
JavaScript
quoteElem.innerHTML = getQuote(randomQ);




NB: The MDN documentation for Math.random includes an example that's almost what you need for #5 - generating a random integer between 0 and max - 1. You should be able to adapt that to your requirement with a little basic arithmetic. Smile | :)



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

QuestionRe: Javascript help Pin
ghazabaz9-Nov-18 5:55
ghazabaz9-Nov-18 5:55 
AnswerRe: Javascript help Pin
Richard Deeming9-Nov-18 7:48
mveRichard Deeming9-Nov-18 7:48 
Generalguidence for the begginners Pin
Kshitiz Thapa2-Nov-18 3:16
Kshitiz Thapa2-Nov-18 3:16 
GeneralRe: guidence for the begginners Pin
Richard MacCutchan2-Nov-18 4:00
mveRichard MacCutchan2-Nov-18 4:00 
SuggestionRe: guidence for the begginners Pin
CHill6015-Nov-18 21:46
mveCHill6015-Nov-18 21:46 
QuestionLoops Pin
Member 1403490227-Oct-18 5:06
Member 1403490227-Oct-18 5:06 
AnswerRe: Loops Pin
Richard MacCutchan27-Oct-18 5:54
mveRichard MacCutchan27-Oct-18 5:54 
QuestionSTOP VALIDATION Pin
Member 1344978425-Oct-18 0:44
Member 1344978425-Oct-18 0:44 
AnswerRe: STOP VALIDATION Pin
Afzaal Ahmad Zeeshan25-Oct-18 2:40
professionalAfzaal Ahmad Zeeshan25-Oct-18 2:40 
Questionno me funciona funcion autocomplete Jquery Pin
serenimus20-Oct-18 8:53
serenimus20-Oct-18 8:53 
AnswerRe: no me funciona funcion autocomplete Jquery Pin
Nelek20-Oct-18 8:59
protectorNelek20-Oct-18 8:59 
QuestionMap JSON data file with dates and multiple string value pairs to Angular/Chart.js Pin
Member 1201357914-Oct-18 22:08
Member 1201357914-Oct-18 22:08 
Questionaspx file don't open in chrome Pin
anasr200010-Oct-18 2:22
professionalanasr200010-Oct-18 2:22 
Questiontest regexep javascript Pin
Alboyz5-Oct-18 4:31
Alboyz5-Oct-18 4:31 
AnswerRe: test regexep javascript Pin
Richard Deeming5-Oct-18 4:48
mveRichard Deeming5-Oct-18 4:48 
GeneralRe: test regexep javascript Pin
Alboyz5-Oct-18 5:02
Alboyz5-Oct-18 5:02 
GeneralRe: test regexep javascript Pin
uxotucung9-Nov-18 3:09
uxotucung9-Nov-18 3:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.