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
2

Syntax error: Unexpected Number

OtakuMom
OtakuMom

https://repl.it/@OtakuMom/IST113-19S-LI-Final
Okay, so I'm working on my final for my Web Programming class, and this has me kind of stumped. The message I'm getting is "Syntax Error: Unexpected number" on line 14, and being new to Javascript I don't know what that means. If anyone can help it would be greatly appreciated.

4 years ago

Voters

Comments

TopNew
2
theangryepicbanana
theangryepicbanana

You put player 1 instead of player1

4 years ago
1
rediar
rediar

Yes as the angry epic banana said, in “player 1” 1 becomes an unexpected integer.

4 years ago
1
OtakuMom
OtakuMom

After seeing the comments, I now know not to try to code late at night. Oops.

But now I'm having another issue, which is getting it to show up on the page. I don't know if I need to do anything different or if I just need to assign to code to particular objects in order to get it to work. I want to get it to work so that when you click on a picture you've made your choice. I'm trying to adapt this from the same game that I wrote in C# that I've been altering for the past semester in order to help me in my C# class in figuring out how to use that language. With this being more dynamic, I want to use pictures instead of the player choosing a number. So I'm trying to figure out right now how to get the text to show up in the game first before I add the pictures, but it's not showing up, so I don't know if I need to do something different in Javascript in order to get it to play in the browser, or if it just needs something different.

4 years ago
1
TheDrone7
TheDrone7

@OtakuMom
create a function which contains the code that you'll be executing when the HTML element is clicked then, in the HTML file, go-to the element that you want to make interactive and set it's onclick attribute to call the function that you have created.

4 years ago
1
JackFly26
JackFly26

Having spaces in variable names isn't allowed. Most programmers will either use player1 or player_1. Use whatever looks best to you!

4 years ago
1
JackFly26
JackFly26

@ThatSmart
Oof I just realized that you use player1 in other places.

4 years ago
Load more