Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
The above is a screenshot a tutorial in which the tutor used ${ var } to print a variable in js.
But when i ran the same code, i got like this:
What is the actual problem?
'
`
you must use the backtick [ ` ] ; instead of the using [ ' ],So you can solve it.
Add a comment
You're using the wrong quote type. To do what you want you'll need to use backtick. It's the one to the left of the 1 key on most keyboards.
console.log(Server at port ${port}) // Don't put "" or ''. Use ``
Server at port ${port}
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
'to format the string, you have to use `(backtick)`) instead of'.