Light.js " and ' difference


#1

it doesnt accept this code:
const visibleLightWaves = () => {
let lightWaves ="'Moonlight";
};

but accepts this one:
const visibleLightWaves = () => {
let lightWaves = ‘Moonlight’;
};
why is this a problem?


#2

Those are different strings (different length)


#3

I dont understand. Since one backspace deletes both double quote and single quote, why are they considered different length ?


#4

Didn’t say the quotes are different. The data is different. They do not have the same number of characters in them.

Right now you’re taking a quick look at them and saying that they look “about the same”, you need to compare them character-by-character so that even if there is only one difference, you’ll find it.
A similar problem by the way, is that you haven’t shared exact copies, what you posted is most likely slightly different from what you’re using because forum formatting has been applied to them. Code needs to be copied exactly (byte for byte) which is something that you can accomplish with help from the buttons in the post editor (especially when it’s a matter of being different by a single character, but not much less for any code because it doesn’t take much before the meaning changes, and others also can’t tell if the meaning has changed, simply not knowing if one is looking at the same code or not is bad)


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.