javascript - This is a conditional statement with 2 conditions, I need to add a 3rd -
first, not js apologies in advance noob question.
like title says, have line:
stringvalue = numericvalue >= 1000 ? numericvalue.tostring().substr(0, numericvalue.tostring().length - 3) + "tb" : numericvalue + "gb"; basically, if value on 1000, appends "tb", , under 1000 appends "gb". need third condition if it's under 50 gets rid of text altogether.
i can see if/else statement, can't quite decode , figure out how add in third condition. in advance!
this should work:
stringvalue = numericvalue >= 1000 ? numericvalue.tostring().substr(0, numericvalue.tostring().length - 3) + "tb" : (numericvalue > 50 ? numericvalue + "gb" : numericvalue);
Comments
Post a Comment