• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick javascript question...

A. "Today is ' + day1
B. "day1: " + day1 + '; week1: ' + week1
C. day1 " + " week1
D. "day1" " + " "week1"

This makes no sense to me because with my current knowledge (hoorah for entry level computer science?) none of them are correct. Yet those are the only options...

Am I right?

Otherwise it'd be just a literal expression and the answer would be D. The question asks for a valid string expression when day1 and week1 are variables.
 
NM: Didn't see it at the end of the OP

Wait, nm, the answer is B. You can use ' or " on the same line IIRC, but a single quote can't close a double quote and visa versa

I can't read letters apparently. 😛

A: Invalid can't mix ' and "
C: There is no concatenation operator since the + is in quotes
D: No escape characters for the "
 
Originally posted by: tfinch2
NM: Didn't see it at the end of the OP

Wait, nm, the answer is B. You can use ' or " on the same line IIRC, but a single quote can't close a double quote and visa versa

I can't read letters apparently. 😛

A: Invalid can't mix ' and "
C: There is no concatenation operator since the + is in quotes
D: No escape characters for the "

Was thinking about the apostrophes... It seems possible, just that we were never taught to use them... Rather not take a chance since this is due at the end of the day tomorrow and ask the professor to see if any typos were actually made.

Thanks guys 🙂
 
B is closest to valid, assuming week1 is a declared variable. I'm not sure about mixing single and double quotes in the same expression though.
 
Originally posted by: Mxylplyx
B is closest to valid, assuming week1 is a declared variable. I'm not sure about mixing single and double quotes in the same expression though.

You are allowed to, I've tried it 🙂.
 
Back
Top