Click here to Skip to main content
15,440,552 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: New to Coding Pin
John Wiser25-Jul-22 9:44
MemberJohn Wiser25-Jul-22 9:44 
QuestionI need help with a task Pin
User 1567076221-Jul-22 11:35
MemberUser 1567076221-Jul-22 11:35 
AnswerRe: I need help with a task Pin
jeron121-Jul-22 11:56
Memberjeron121-Jul-22 11:56 
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
MemberUser 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
MemberUser 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
Memberjanaswamy uday12-Jul-22 7:23 
AnswerRe: extract value from json Object in Node JS Pin
Ben Code15-Aug-22 23:59
MemberBen Code15-Aug-22 23:59 
QuestionWebView2 - Send Script with a Value Pin
Alan Burkhart5-Jul-22 9:28
MemberAlan 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
MemberAlan 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
MemberAlan Burkhart8-Jul-22 0:24 
QuestionRotate text Pin
Rockallica13-Jun-22 13:57
MemberRockallica13-Jun-22 13:57 
AnswerRe: Rotate text Pin
Graham Breach13-Jun-22 20:58
MemberGraham Breach13-Jun-22 20:58 
GeneralRe: Rotate text Pin
Rockallica14-Jun-22 8:38
MemberRockallica14-Jun-22 8:38 
QuestionLaravel 8 integred databending in JS Pin
paradox0210-Jun-22 7:13
Memberparadox0210-Jun-22 7:13 

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.