Click here to Skip to main content
15,502,616 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionSnow fall in Javascript Pin
Member 1497619920-Nov-20 5:15
Member 1497619920-Nov-20 5:15 
AnswerRe: Snow fall in Javascript Pin
Richard Deeming20-Nov-20 5:27
mveRichard Deeming20-Nov-20 5:27 
AnswerRe: Snow fall in Javascript Pin
Akshay digitally9-Dec-20 2:20
Akshay digitally9-Dec-20 2:20 
Questionthe red ball follow cursor in JS Pin
Member 1497619916-Nov-20 17:38
Member 1497619916-Nov-20 17:38 
AnswerRe: the red ball follow cursor in JS Pin
Richard MacCutchan16-Nov-20 22:44
mveRichard MacCutchan16-Nov-20 22:44 
Questionhms@1.0.0 No repository field Pin
Gilbert526214-Nov-20 22:02
Gilbert526214-Nov-20 22:02 
AnswerRe: hms@1.0.0 No repository field Pin
Richard MacCutchan14-Nov-20 23:10
mveRichard MacCutchan14-Nov-20 23:10 
QuestionJs question Pin
Member 1499144112-Nov-20 11:28
Member 1499144112-Nov-20 11:28 
Hi, I need help on this question

"We want to know whether to order a particular candy. We should make an order if the total number in stock (inStock) is less than the weekly average sold (weeklyAverage).

Create a function called shouldWeOrderThisCandy that takes in
the inventory array
a specific type of candy (string)
The function should find the candy in the array that matches the name passed in.

When that candy is found, return true if the number inStock is less than the weeklyAverage. Otherwise return false.

If the array doesn't have any candy with that name, return false

This is what I have so far.

function shouldWeOrderThisCandy(inventory, string) {
for (let i = 0; i < inventory.length; i++) {
if (inventory[i] === string && inStock < weeklyAverage) {
return true;
} else {
return false;
}
}
return false
}
QuestionRe: Js question Pin
Richard MacCutchan12-Nov-20 22:44
mveRichard MacCutchan12-Nov-20 22:44 
Questiontoo many scripts? Pin
Member 1469595610-Nov-20 23:18
Member 1469595610-Nov-20 23:18 
AnswerRe: too many scripts? Pin
Richard Deeming10-Nov-20 23:42
mveRichard Deeming10-Nov-20 23:42 
GeneralRe: too many scripts? Pin
Member 1469595611-Nov-20 0:37
Member 1469595611-Nov-20 0:37 
AnswerRe: too many scripts? Pin
Sandeep Mewara10-Nov-20 23:46
mveSandeep Mewara10-Nov-20 23:46 
GeneralRe: too many scripts? Pin
Member 1469595611-Nov-20 0:35
Member 1469595611-Nov-20 0:35 
Question[Vanilla Javascript Newbie] How to access a function of a function from a part of code oustide this function Pin
GlowWurm19778-Nov-20 11:03
GlowWurm19778-Nov-20 11:03 
AnswerRe: [Vanilla Javascript Newbie] How to access a function of a function from a part of code oustide this function Pin
Richard MacCutchan8-Nov-20 22:58
mveRichard MacCutchan8-Nov-20 22:58 
AnswerRe: [Vanilla Javascript Newbie] How to access a function of a function from a part of code oustide this function Pin
Richard Deeming9-Nov-20 23:07
mveRichard Deeming9-Nov-20 23:07 
QuestionGet image extension Pin
Valentinor4-Nov-20 4:10
Valentinor4-Nov-20 4:10 
AnswerRe: Get image extension Pin
Blanksy8-Nov-20 12:12
Blanksy8-Nov-20 12:12 
GeneralRe: Get image extension Pin
Valentinor8-Nov-20 20:33
Valentinor8-Nov-20 20:33 
GeneralRe: Get image extension Pin
Richard Deeming8-Nov-20 22:53
mveRichard Deeming8-Nov-20 22:53 
GeneralRe: Get image extension Pin
Valentinor9-Nov-20 6:43
Valentinor9-Nov-20 6:43 
GeneralRe: Get image extension Pin
Richard Deeming9-Nov-20 6:58
mveRichard Deeming9-Nov-20 6:58 
GeneralRe: Get image extension Pin
Valentinor9-Nov-20 11:31
Valentinor9-Nov-20 11:31 
GeneralRe: Get image extension Pin
Richard Deeming9-Nov-20 22:36
mveRichard Deeming9-Nov-20 22:36 

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.