Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
jQuery How To Use Backticks In Append

I wanted to interpolate variables in strings in JS so I used ``(backticks) as shown here - How To Interpolate Variables In String in JS

Then, I Wanted To put IF-Statements in jQuery Append So I got this - IF Statements In jQuery Append

But When I use Both Together , Backticks Don't Output Text As Usual-

$("main").append(`Hello ${my_var}`+(second_var>1?"hi ":"bye")+`Bye ${my_var})`

This Results Only In "hi" , The Backticks Before And After The Ternary Operator Don't Output Anything. HELP ??

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can do something like the below.

const my_var = "Name";
const seconde_var = 2;
console.log(`Hello ${my_var} ${seconde_var >1 ? "hi": "bye"} bye ${my_var}`);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!