Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,548 members, 7,955,038 topics. Date: Saturday, 21 September 2024 at 03:09 PM |
Nairaland Forum / Science/Technology / Programming / Help A Beginner With Javascript (1072 Views)
Which Programming Language Should A Beginner Start With? / Mobile Technology: Lets Build A Mobile App With Javascript / Java Tutorial Made Easy For Absolute Beginner With No Programming Experience.. (2) (3) (4)
Help A Beginner With Javascript by Nobody: 8:37am On Apr 29, 2017 |
I just started learning JavaScript and I'm trying to write a program that tells grade based on your score,everytime I input the code I keep getting "SyntaxError: missing ) after condition This is the code I wrote, gurus in the house should help me out I'm testing it on console.log Var scores="grade" if (scores < 100 AND scores> 75); {Console.log( student got an A); } |
Re: Help A Beginner With Javascript by Nobody: 8:45am On Apr 29, 2017 |
I am a beginner too, but you can try below rewritten code. Var scores="grade"; if (scores < 100 AND scores> 75) {Console.log( "student got an A" ); } Dayvhid: |
Re: Help A Beginner With Javascript by ANTONINEUTRON(m): 8:50am On Apr 29, 2017 |
misplaced semi-colon ';' 2 Likes |
Re: Help A Beginner With Javascript by Ftrcdn(m): 1:37pm On Apr 29, 2017 |
If there is something below a beginner then that's what I am. Well, I think the error should be with your "AND". Trying using a double ampersand like this "&&" and if the problem persists remember the word I highlighted.. You are welcome. |
Re: Help A Beginner With Javascript by Dekatron(m): 4:33pm On Apr 29, 2017 |
Use & & where you used AND.... |
Re: Help A Beginner With Javascript by yorex2011: 7:51pm On Apr 29, 2017 |
Dayvhid: Should be If(scores < 100 && scores > 75){ console.log('student got an A') ; } Your code sef.. How are you comparing string and numbers...? 1 Like |
Re: Help A Beginner With Javascript by etoluw: 10:38pm On Apr 29, 2017 |
Dayvhid: if grades is a variable, you dont need to quote it i.e var scores = grade; |
Re: Help A Beginner With Javascript by klefjoxey: 7:54am On Apr 30, 2017 |
Dayvhid:Use if else statement |
Re: Help A Beginner With Javascript by godOfNairaland: 8:22am On Apr 30, 2017 |
Dayvhid: Let me point out the errors: Var scores="grade" ::: should be Var scores=grade; (since grade is a variable, no need for quotation mark). if (scores < 100 AND scores> 75); ::: should be if (scores <= 100 AND scores>= 75) (since both 75 & 100 are also A, it should be less than or equal to && greater than or equal to. Also note that the semi colon at the end of the statement has been removed. You can't put a semi colon at the closing bracket of an If statement). Full code will be: Var scores=grade; if (scores <= 100 AND scores >= 75){ Console.log('student got an A'); } 1 Like |
Re: Help A Beginner With Javascript by Nobody: 11:13am On Apr 30, 2017 |
godOfNairaland:This was really helpful,thanks for your time. |
(1) (Reply)
Difficulties You Experienced While Learning To Program. / SQL Database Or Access Database Work / Learn Programming
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 33 |