2 Answers

Your getting an unexpected identifier because of the double quotes (") in the href attribute in the <a> tag.

Because you are using double quotes (") to create your string, when you try to use them in the <a>, they are ending your string literal.

You currently have:

var email_HTMLbody = "Hey " + firstName + "a lot of text... then <a href="someurl
                                                                         ^     ^
                                                            end of string|     |
                                                             this is unexpected|   

You could escape the double quotes in the href with a backslash before the double quote ("):

var email_HTMLbody = "... <a href="someurl">click me </a>"

or use backticks:

var email_HTMLbody = `... <a href="someurl">click me </a>`

Answered by dwmorrin on November 15, 2021

Perhaps, but the result I tried with the same code

It worked when n was put in
and the URL part of http was enclosed in single quotes.

Answered by officeforest on November 15, 2021

Add your own answers!

Related Questions

React.js search filtration on the array of objects

2  Asked on October 21, 2020 by ven-nilson


C# and the FileSystemWatcher

1  Asked on October 18, 2020 by thorsten-schroeer


C++ enum class with constructor

1  Asked on October 17, 2020 by cry0genic


Recharts ReferenceLine between data points

1  Asked on October 15, 2020 by philipp


Transform Issue With Bootstrap Card

3  Asked on October 15, 2020 by natalia-davydova


NGINX gives 502 error from browsers but not from Postman

1  Asked on October 13, 2020 by knguyen


Python Pandas cumsum with shift of n

1  Asked on October 10, 2020 by gonzalo-polo


How to read only half a byte from a binary file at a time in C?

2  Asked on October 9, 2020 by nguyenvivian


Failed to install laravel/jetstream on laravel 8

2  Asked on October 8, 2020 by vldcndn


Ask a Question

Get help from others!

© 2021 All rights reserved.