Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,158,420 members, 7,836,678 topics. Date: Wednesday, 22 May 2024 at 11:30 AM

Help A Beginner With Javascript - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help A Beginner With Javascript (1049 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)

(1) (Reply) (Go Down)

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:
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 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:
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);
}

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:
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);
}

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:
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);
}
Use if else statement
Re: Help A Beginner With Javascript by godOfNairaland: 8:22am On Apr 30, 2017
Dayvhid:
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);
}

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:


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');
}
This was really helpful,thanks for your time.

(1) (Reply)

Functional E_commerce Websites..... Make Million Sales Instantly / Please How Can I Learn Social Media Hacking And Other Hacking Tools / I Am Stuck In My Project...i Need Help From A Good Java Programmer

(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. 34
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.