I can't seem to figure out how to implement a "prompt"


#1

I'm new to the JavaScript language and I'm trying to use prompt command for this statement:

("Where are you from?")

using this statement:
var=window.prompt("What is your name");

The statement says: Syntax Error: Unexpected Identifier.

Any suggestions?


#2

var yourPrompt = prompt("What is your name");

first you state the name of your variable:

var yourPrompt

then you set it equal to a prompt

var yourPrompt = prompt("What is your name");

Note

yourPrompt could be anything, whatever you want the variable name to be :slightly_smiling:

Hope that helped :sunny:


#3

I typed the statement prompt for the training exercise for JavaScript, but it still doesn't allow me to move to the next lesson. It displayed the statement :


#4

Sorry didn't get the chance to finish typing. The error message said: Oops, something went wrong. Try again. Are there any errors in the this prompt example?

var yourPrompt = prompt("What is your name");


#5

Can you show us your full code please?


#6

var place=prompt("Where are you from?");


#7

What lesson are you doing?


#8

I am working on Lesson 9.


#9

Lesson 9 is not asking you to set the prompt to a variable. Take a look at the examples they give you. All you have to do with your current code is delete 3 things and you can move on to the next lesson :slightly_smiling:

If you still cannot figure it out, let me know!


#10

I typed this statement on the lesson: prompt("Where are you from?");
When I try to save and submit code, this error message appeared on my screen:
Oops. Try again. Something went wrong with your prompt.


#11

Try refreshing your browser. Your code works fine for me on Lesson #9.


#12

Is it possible that my version of windows or Internet access is preventing me from executing the code?


#13

It might be an issue with your browser. Try on different browser types or different computers.


#14

Thanl new for the esxgace devueovredue.


#15

You were right, I was using internet Explorer and it didn't work. When I switched to Chrome, the prompt command popped up after I saved and submitted the code. Any reason why a program might work on one browser and not on another?


#16

I'm glad you got it working. To be honest, I do not know the exact issue of why it would not work on one browser and work on another.

Hey @g4be: Do you know what the exact issue is when people cannot get their code to work on one browser but it works on another?


#17

@jaaakee: The first thing that comes to my mind is "compability".
I've heard several times people saying that certain applications run "better" or only run at specific browsers.
The reason for that is the code they created to execute something, in our case the codes, probably runs more efficiently on certain browsers.
Maybe the most recent browsers have capabilites to support our applications, that each day require more and more things to be done.

I once tested Codecademy on IE and I have to say the page took quite a while to load, where on Chrome it loads almost automatically.
Could it be an extension, a malware or something? Maybe but I've checked and there are no such things.

The user who's been complaining about the fact the message was not being prompted could check if he/she didn't mark a checkbox saying if he/she didn't want those messages to show up on their screen, which we have to agree is relatively annoying at certain times.


#18

Another thing I thought of is "support". I was thinking this issue was because of IE not having a lot of developer support as Firefox or Chrome does. That is what I was thinking, but I did not write it because I do not want to give false information out (even though you could say I am now :c).

@captainn: You should continue using Google Chrome/Firefox so you can avoid these issues with browsers. I'm glad your problem is resolved! :slightly_smiling:


#19

@jaaakee: Hmm ... older versions of it, yes.
Newest version(s) of it, no.

1 - Microsoft Today Ends Support For Windows 8, Old Versions Of Internet Explorer
2 - Support for older versions of Internet Explorer ended on January 12th, 2016

There's IE11 with, if I'm not wrong, a few upgrades, mostly security upgrades.
Could the user be using an "old" version of IE ? Could it be IE security? Don't know but if the user tries to update to IE11 and things work smoothly, than maybe it was something with the older versions.


#20

Yesh doesnt work on Opera too. Only Chrome browser :slight_smile: