Join the Webstudio community

Updated 2 months ago

Use of vars

At a glance

The community member is confused about when to use the ${} syntax in JavaScript. The comments explain that ${} is an interpolation syntax used to insert variables into strings. The community members discuss that this is a standard JavaScript syntax, and if in doubt, they can ask an AI assistant like this one for clarification.

I don't really need help. Just something that's unclear to me.
Sometimes we need to put a var inside ${...} and sometimes we don't?
I am sure this makes total sense to anyone who knows why. But I think it's an example of the type of thing that can be confusing for 'no-coders'.
O
5 comments
${} is an interpolation syntax inside a string
You put variable inside a string basically
On the left you made an object, not a string
btw if in doubt, ask AI, its a standard javascript syntax it knows
Add a reply
Sign up and join the conversation on Discord