Random Quote Machine and Twitter

Hey, I’m trying to make my random quote machine share the current quote to twitter as a tweet, but I’m stuck and don’t know how to move forward. My variable does not get passed into the text when I try to set my href attribute equal to “https://www.twitter.com/intent/tweet?text={myVariable}” . Whenever twitter would get opened the tweet would be “{myVariable}” What can I do ?

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36.

Challenge: Build a Random Quote Machine

Link to the challenge:

1 Like

Could you try this?


It still isn’t working, here’s a link to the my code: https://codepen.io/Maco-t/pen/QWGZWZd?editors=0010

Sorry I don’t really have an answer for you. but I do have a question.

Are you using css inside your Javascript?

Yeah, why do you ask?

1 Like

I asked because Im in the process of learning Javascript, though I am aware of the fact that you can manipulate css with javascript; I didn’t really know that one could essentially style an entire page with javascript alone! this is really exiting!

1 Like

Add a variable below author that uses a template literal, e.g.

const url=`https://www.twitter.com/intent/tweet?text=${quote}`

You have to use backticks. (`)

Then use this variable.

Works just fine: