+ 6

find error in code

<html> <head><title>Hello</title></head> <body> <script type ="text/javascript"> //Program name : //Author : Sahil Chib //Date Created : 10/10/2020 //Variable Declaration var studentName; var I=internationalFull-time; var F=domesticFull-time; var P=domesticPart-time; var studentStatus; var BR=<br/>"; //Gather Input studentName = prompt("Enter Your Name",""); studentStatus = prompt("What is your status?",""); internationalFull-time = prompt("Enter I for internationalFull-time",""); domesticFull-time= prompt("Enter F for internationalFull-time",""); domesticPart-time= prompt("Enter P for internationalFull-time",""); if{(studentStatus == I) {"document.write "Go to room 227 +BR+ THANK YOU FOR USING THE PROGRAM" }; else if(studentStatus == F) { "document.write "Go to room 123 +BR+ THANK YOU FOR USING THE PROGRAM" }; else(studentStatus == P) { "document.write "Go to room 055 +BR+

11th Oct 2020, 1:59 PM
Sahil Chib
Sahil Chib - avatar
34 ответов
+ 3
Jayakrishna🇮🇳 i haven't used minus sign
11th Oct 2020, 3:42 PM
Sahil Chib
Sahil Chib - avatar
+ 3
- (hyphon)? In InternationalFull-time;? You can use underscore like InternationalFull_time;Sahil Chib
11th Oct 2020, 3:43 PM
Jayakrishna 🇮🇳
+ 3
Jayakrishna🇮🇳 could you tell what to initialize in this code
11th Oct 2020, 3:46 PM
Sahil Chib
Sahil Chib - avatar
+ 3
<html> <head><title>Hello</title></head> <body> <script type ="text/javascript"> //Program name : //Author : Sahil Chib //Date Created : 10/10/2020 //Variable Declaration var internationalFull_time = prompt("Enter I for internationalFull-time",""); var domesticFull_time = prompt("Enter F for internationalFull-time",""); var domesticPart_time = prompt("Enter P for internationalFull-time",""); var studentStatus; var BR="<br/>"; //Gather Input var studentName = prompt("Enter Your Name",""); studentStatus = prompt("Enter student status :", "" ); if(studentStatus == "I") document.write("Go to room 227 "+BR+ "THANK YOU FOR USING THE PROGRAM"); else if(studentStatus == "F") { document.write("Go to room 123 "+BR+ "THANK YOU FOR USING THE PROGRAM"); } else if(studentStatus == "P") { document.write("Go to room 055 "+BR+ "THANK YOU FOR USING THE PROGRAM") } ; </script>
11th Oct 2020, 4:24 PM
Jayakrishna 🇮🇳
12th Oct 2020, 2:00 PM
Sahil Chib
Sahil Chib - avatar
+ 3
Sharofiddin bro I written JavaScript
12th Oct 2020, 2:14 PM
Sahil Chib
Sahil Chib - avatar
+ 3
Your first if block that checks studentStatus is syntactically wrong. The curly brace should be after the condition. The second else if block doesn't have to end to with a semi colon The last else block is missing a closing brace.
13th Oct 2020, 4:59 AM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
+ 2
var i = InternationalFull-time; Here you can't use -minus sign in variables. It's invalid. Learn about variable declarations. And it still undefined so can't assign it before initialization. First initialize, and assign value then use it. There are more similar errors... And document.wrire function is not defined properly.. Use braces like document.write( "hello" );
11th Oct 2020, 2:28 PM
Jayakrishna 🇮🇳
+ 2
11th Oct 2020, 3:44 PM
Sahil Chib
Sahil Chib - avatar
+ 2
Jayakrishna🇮🇳 could you give me an example how?
11th Oct 2020, 3:47 PM
Sahil Chib
Sahil Chib - avatar
+ 2
//Variable Declaration these 3 are invalid var I=internationalFull-time; var F=domesticFull-time; var P=domesticPart-time; Correct way : var internationalFull_time; //using underscore var domesticFull_time; var domesticPart_time; Now take values into these variables by prompt.. ( Or directly take while initialization like var InternationalFull_time = prompt("Enter" ""); ) And then after assign to I, F, P Like var I = internationalFull_time; var F = domesticFull_time; var P = domesticPart_time;
11th Oct 2020, 3:55 PM
Jayakrishna 🇮🇳
+ 2
Jayakrishna🇮🇳 ok bro what else is wrong
11th Oct 2020, 3:57 PM
Sahil Chib
Sahil Chib - avatar
+ 2
Do I have to write both in //variable declaration section? var internationalFull_time; var domesticFull_time; var domesticPart_time; Jayakrishna🇮🇳
11th Oct 2020, 4:02 PM
Sahil Chib
Sahil Chib - avatar
+ 2
I already told it on 1st post all. document.write "hello" like this you wrote but document.write( " hello" ); correct way. Oh. What actually you are trying? Are you trying like InternationalFull_time == "I" Then actually no need to declare I, F, P In if statements use it like "I", "F",, "P" instead I, F, P.. Remove I, F, P declarations..
11th Oct 2020, 4:04 PM
Jayakrishna 🇮🇳
+ 2
Jayakrishna🇮🇳 hi bro I didn't get you could you write and it
11th Oct 2020, 4:06 PM
Sahil Chib
Sahil Chib - avatar
+ 2
Jayakrishna🇮🇳 ok bro is it error free now
11th Oct 2020, 4:20 PM
Sahil Chib
Sahil Chib - avatar
+ 2
Jayakrishna🇮🇳 I have sent you a message please reply there. I am making another one, could you fix that
11th Oct 2020, 4:21 PM
Sahil Chib
Sahil Chib - avatar
+ 1
Sahil Chib I dont got any message. May be My DM not work.. You can leave.. or here make question some other can answer. I try to look it after some time brake.
11th Oct 2020, 4:29 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 its a question actually we have to make java statement out of question
11th Oct 2020, 4:31 PM
Sahil Chib
Sahil Chib - avatar
+ 1
Jayakrishna🇮🇳 can I tell you question here
11th Oct 2020, 4:32 PM
Sahil Chib
Sahil Chib - avatar