Light.js " and ' difference

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

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

Those are different strings (different length)

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

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)

1 Like

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