0

Image from Visual Studio Code- please view image

I need to find out what the issues are here. I was following a tutorial with Udemy to help me learn how to code. I was coding along trying to learn template literals and I received this error.

const firstName = 'Greg';
    const myjob = 'web developer';
    const birthYear = 1991;
    const currentYear = 2037;


    const newSentence = "I'm " + firstName + ', a ' + (currentYear - birthYear) + ' year 
    old ' + myjob + '!';
    console.log(newSentence);

    const gregNew = 'I'm ${ firstName }, a ${ currentYear - birthYear} year old ${ myJob 
     } !';

    console.log(gregNew);
VLAZ
  • 26,331
  • 9
  • 49
  • 67
  • `'I'm` is starting a string with single quote, putting `I` in it and then ending the string with another single quote. Which means that the following `m` is a syntax error. – VLAZ Nov 26 '21 at 19:27
  • Ok, I see that. so thank you. When I remove that it does display in the console, but reads "Im ${firstName}, a {currentYear-birthYear} year old ${myJob} !" I want it to display the assigned variable in the console. – student_learner Nov 26 '21 at 19:49

0 Answers0