Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

SyntaxError: Unexpected token '<'

tymergoss
tymergoss

https://repl.it/join/guzonkcv-tymergoss

I've tried everything I can think of. Searched around the web to try and locate a solution. Everything I try just ends up coming up with another syntax error. My assignment is over due and I need help so I can turn it in for partial credit

2 years ago
You are viewing a single comment. View All
2
Coder100
Coder100

did you just copy and paste code lol

That's not valid syntax, you must actually have the variable like this:

var b = "apple"; console.log("a" + b);

Here's the working code:

function makeInsult() { var words1 = ["artless", "bootless", "clouted", "clouted", "errant"]; var words2 = ["beef-witted", "dismal-dreaming", "fat-kidneyed", "half-faced", "tickle-brained"]; var words3 = ["barnacle", "death-token", "foot-licker", "measle", "varlot"]; var rand1 = Math.floor(Math.random() * words1.length); var rand2 = Math.floor(Math.random() * words2.length); var rand3 = Math.floor(Math.random() * words3.length); let w1 = words1[rand1]; let w2 = words2[rand2]; let w3 = words3[rand3]; var insult = "Thou " + w1 + " " + w2 + " " + w3 + "!"; return insult; }
2 years ago
1
tymergoss
tymergoss

@Coder100
I copied the code from phrase-o-matic. That was the first part of our task one and then our instructor wanted us to use the same code for insult-o-matic, but change how the phrase is generated. Thanks for your help!

2 years ago
2
Coder100
Coder100

np!
mark as correct answer please

@tymergoss

2 years ago