Click here to Skip to main content
16,009,653 members
Home / Discussions / JavaScript
   

JavaScript

 
Questionjavascript looping pattern question Pin
ravindra Yadav 202213-Aug-22 1:22
ravindra Yadav 202213-Aug-22 1:22 
AnswerRe: javascript looping pattern question Pin
Richard MacCutchan13-Aug-22 1:31
mveRichard MacCutchan13-Aug-22 1:31 
QuestionJavascript Pin
User 1567076229-Jul-22 0:20
User 1567076229-Jul-22 0:20 
AnswerRe: Javascript Fibonacci sequence Pin
Richard MacCutchan29-Jul-22 3:28
mveRichard MacCutchan29-Jul-22 3:28 
RantRe: Javascript Pin
Richard Deeming1-Aug-22 0:29
mveRichard Deeming1-Aug-22 0:29 
QuestionI need help in defining and calling Static variable in Typescript. Pin
Afi_sh26-Jul-22 5:01
Afi_sh26-Jul-22 5:01 
AnswerRe: I need help in defining and calling Static variable in Typescript. Pin
Jeremy Falcon26-Oct-22 11:41
professionalJeremy Falcon26-Oct-22 11:41 
QuestionNew to Coding Pin
John Wiser25-Jul-22 3:05
John Wiser25-Jul-22 3:05 
AnswerRe: New to Coding Pin
Richard MacCutchan25-Jul-22 3:10
mveRichard MacCutchan25-Jul-22 3:10 
GeneralRe: New to Coding Pin
John Wiser25-Jul-22 9:44
John Wiser25-Jul-22 9:44 
AnswerRe: New to Coding Pin
Jeremy Falcon26-Oct-22 11:49
professionalJeremy Falcon26-Oct-22 11:49 
QuestionI need help with a task Pin
User 1567076221-Jul-22 11:35
User 1567076221-Jul-22 11:35 
AnswerRe: I need help with a task Pin
jeron121-Jul-22 11:56
jeron121-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
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 

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.