Click here to Skip to main content
15,889,216 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: I need help with a task Pin
jsc4225-Jul-22 4:11
professionaljsc4225-Jul-22 4:11 
QuestionI need help with an Javascript exercise! Pin
User 1567076215-Jul-22 20:39
User 1567076215-Jul-22 20:39 
GeneralRe: I need help with an Javascript exercise! Pin
Richard MacCutchan15-Jul-22 21:29
mveRichard MacCutchan15-Jul-22 21:29 
GeneralRe: I need help with an Javascript exercise! Pin
User 1567076215-Jul-22 22:59
User 1567076215-Jul-22 22:59 
GeneralRe: I need help with an Javascript exercise! Pin
Richard MacCutchan15-Jul-22 23:09
mveRichard MacCutchan15-Jul-22 23:09 
Your code is quite confused, and confusing. You specify that the function takes an input parameter named colorCode, but you never refer to it in the function. Your if/else clauses include the variable condition which is never defined anywhere. Finally you return the randomNumber for no reason I can see.

- The function does not need an input parameter, unless you want to pass it a random number. Assuming yo do not, then generate the number as the first step.
- The if statements only need to be as follows
- 1: If the value is less than 10 set colorCode to "green"
- 2: Else If it is less than 50 set colorCode to "yellow" (we already know it is not less than 10)
- 3: Else set it to "blue" (it must be 50 or greater)
- return colorCode to the caller of the function.


modified 16-Jul-22 7:11am.

GeneralRe: I need help with an Javascript exercise! Pin
Eddy Vluggen16-Jul-22 3:53
professionalEddy Vluggen16-Jul-22 3:53 
GeneralRe: I need help with an Javascript exercise! Pin
Richard MacCutchan16-Jul-22 4:18
mveRichard MacCutchan16-Jul-22 4:18 
GeneralRe: I need help with an Javascript exercise! Pin
Eddy Vluggen16-Jul-22 4:46
professionalEddy Vluggen16-Jul-22 4:46 
GeneralRe: I need help with an Javascript exercise! Pin
Richard MacCutchan16-Jul-22 4:51
mveRichard MacCutchan16-Jul-22 4:51 
GeneralRe: I need help with an Javascript exercise! Pin
Eddy Vluggen16-Jul-22 5:00
professionalEddy Vluggen16-Jul-22 5:00 
AnswerRe: I need help with an Javascript exercise! Pin
Gerry Schmitz16-Jul-22 5:49
mveGerry Schmitz16-Jul-22 5:49 
Questionextract value from json Object in Node JS Pin
janaswamy uday12-Jul-22 7:23
janaswamy uday12-Jul-22 7:23 
AnswerRe: extract value from json Object in Node JS Pin
Ben Code15-Aug-22 23:59
Ben Code15-Aug-22 23:59 
QuestionWebView2 - Send Script with a Value Pin
Alan Burkhart5-Jul-22 9:28
Alan Burkhart5-Jul-22 9:28 
AnswerRe: WebView2 - Send Script with a Value Pin
Richard Deeming7-Jul-22 2:19
mveRichard Deeming7-Jul-22 2:19 
GeneralRe: WebView2 - Send Script with a Value Pin
Alan Burkhart7-Jul-22 14:05
Alan Burkhart7-Jul-22 14:05 
GeneralRe: WebView2 - Send Script with a Value Pin
Richard Deeming7-Jul-22 21:42
mveRichard Deeming7-Jul-22 21:42 
GeneralRe: WebView2 - Send Script with a Value Pin
Alan Burkhart8-Jul-22 0:24
Alan Burkhart8-Jul-22 0:24 
QuestionRotate text Pin
Rockallica13-Jun-22 13:57
Rockallica13-Jun-22 13:57 
AnswerRe: Rotate text Pin
Graham Breach13-Jun-22 20:58
Graham Breach13-Jun-22 20:58 
GeneralRe: Rotate text Pin
Rockallica14-Jun-22 8:38
Rockallica14-Jun-22 8:38 
QuestionLaravel 8 integred databending in JS Pin
paradox0210-Jun-22 7:13
paradox0210-Jun-22 7:13 
Questionissue with my app Pin
james michael May20225-Jun-22 2:27
james michael May20225-Jun-22 2:27 
QuestionDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Pin
Member 1564789823-May-22 19:35
Member 1564789823-May-22 19:35 
AnswerRe: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Pin
Richard Deeming23-May-22 21:19
mveRichard Deeming23-May-22 21:19 

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.