lundi 20 août 2018

Why is this code in JS is not working?

The issue is with the ${id} part. It should work and get the string from const id variable.

const id = 'Something';

if(id){
  alert("This ID is ${id}");
} else {
  alert('No ID');
}

However when I check it, it simple pops back

This ID is ${id}

What's wrong with this ? Am I using not the right {} bracket?

Aucun commentaire:

Enregistrer un commentaire