Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,753 members, 7,820,607 topics. Date: Tuesday, 07 May 2024 at 06:04 PM

Need Someone To Help With My Javascript Code - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Need Someone To Help With My Javascript Code (1180 Views)

I Want To Add A Backend Tech To My Javascript Knowledge. Java, PHP Or Python? / Please Help With This Javascript Code / Javascript Code Not Performing Its Functionality (2) (3) (4)

(1) (Reply) (Go Down)

Need Someone To Help With My Javascript Code by Iamsheye(m): 5:28pm On May 12, 2020
So I've got that code there..
Everything's fine except that when a wrong input(one that is not in the array) is inserted I want it to show what's on line 16 but it doesn't it's just empty

Can someone please help??

Re: Need Someone To Help With My Javascript Code by thug: 5:41pm On May 12, 2020
Change the document.write(courseCheck to courseLength), your code would work perfect, cos you are looping with the variable u declared...
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 5:54pm On May 12, 2020
thug:
Change the document.write(courseCheck to courseLength), your code would work perfect, cos you are looping with the variable u declared...
The courseLength is a number,it didn't work

What I want to do is just show that "It is not a science course" when the wrong value in inserted in the prompt
Re: Need Someone To Help With My Javascript Code by peterincredible: 6:33pm On May 12, 2020
Iamsheye:

The courseLength is a number,it didn't work

What I want to do is just show that "It is not a science course" when the wrong value in inserted in the prompt
line 16 is not working change it from "=" to "==" and it will work
Re: Need Someone To Help With My Javascript Code by devdev: 6:44pm On May 12, 2020
Found a solution yet?
Re: Need Someone To Help With My Javascript Code by codeigniter(m): 6:45pm On May 12, 2020
Iamsheye:
So I've got that code there..
Everything's fine except that when a wrong input(one that is not in the array) is inserted I want it to show what's on line 16 but it doesn't it's just empty

Can someone please help??

Change to check == false or !check
! Means not
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 6:52pm On May 12, 2020
peterincredible:
line 16 is not working change it from "=" to "==" and it will work
Bro thanks it worked grin grin
Can't believe it's cos of one thing
I wan run mad before grin grin grin
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 6:52pm On May 12, 2020
codeigniter:


Change to check == false or !check
! Means not
Thanks for this too �
Re: Need Someone To Help With My Javascript Code by Lordpeckxy(m): 8:29pm On May 12, 2020
LoL, U created a thread 4 this cheesy , Welcome to our World... You best best Is to learn how to use community magic...!!! Holla me when you banged on Reg Expressions....
Re: Need Someone To Help With My Javascript Code by Lordpeckxy(m): 8:30pm On May 12, 2020
LoL, U created a thread 4 this cheesy , Welcome to our World... You best best Is to learn how to use community magic...!!! Holla me when you banged on Reg Expressions....

1 Like

Re: Need Someone To Help With My Javascript Code by crunchyDope(m): 9:53pm On May 12, 2020
Iamsheye:
So I've got that code there..
Everything's fine except that when a wrong input(one that is not in the array) is inserted I want it to show what's on line 16 but it doesn't it's just empty

Can someone please help??

why is the line that outputs to the document inside the iteration?

you used the check as a trap and its bin used in every count?
Re: Need Someone To Help With My Javascript Code by Taofeekdboy(m): 10:05pm On May 12, 2020
To simplify your code, you might not need to write if statement again to check if it is not.
Just write if(your statement ) and else(if it's not ). You might not even need the check variable as it will check directly.
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 10:14pm On May 12, 2020
Lordpeckxy:
LoL, U created a thread 4 this cheesy , Welcome to our World...
You best best Is to learn how to use community magic...!!!
Holla me when you banged on Reg Expressions....
Guy I've gotten there grin grin grin I just dropped it to one side

How will I be seeing something like /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"

Am I mad grin grin

1 Like

Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 10:15pm On May 12, 2020
crunchyDope:


why is the line that outputs to the document inside the iteration?

you used the check as a trap and its bin used in every count?
Bro don't worry I've solved it already

This your English sef I no understand
Re: Need Someone To Help With My Javascript Code by crunchyDope(m): 12:10am On May 13, 2020
Iamsheye:
Bro don't worry I've solved it already
This your English sef I no understand

Lol!
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 7:59am On May 13, 2020
So l later got the perfect code I wanted cheesy

Turns out I did not farabale,my blood was hot grin grin

Re: Need Someone To Help With My Javascript Code by Taofeekdboy(m): 8:45am On May 13, 2020
Iamsheye:
So l later got the perfect code I wanted cheesy

Turns out I did not farabale,my blood was hot grin grin
Good bro, but bro the code is too verbose, you can simplify it without using the check variable. Just use if and else statement and the break is unnecessary as well cos you are not using while loop.
if(checkCourse === scorelength or so) {
your logic
} else{ your logic}
You can as well use itenary operator as it makes your code cleaner and efficient.
Re: Need Someone To Help With My Javascript Code by SqueezedPant: 8:51am On May 13, 2020
Iamsheye:
So I've got that code there..
Everything's fine except that when a wrong input(one that is not in the array) is inserted I want it to show what's on line 16 but it doesn't it's just empty

Can someone please help??


you use your phone to code?
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 11:14am On May 13, 2020
SqueezedPant:



you use your phone to code?
Most times,if it's basic or simple stuffs and it's not lengthy
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 11:27am On May 13, 2020
Taofeekdboy:
Good bro, but bro the code is too verbose, you can simplify it without using the check variable. Just use if and else statement and the break is unnecessary as well cos you are not using while loop.
if(checkCourse === scorelength or so) {
your logic
} else{ your logic}
You can as well use itenary operator as it makes your code cleaner and efficient.
Tried this, didn't work so I figured lemme do it another way
Re: Need Someone To Help With My Javascript Code by SqueezedPant: 12:01pm On May 13, 2020
Iamsheye:

Most times,if it's basic or simple stuffs and it's not lengthy


what app?
Re: Need Someone To Help With My Javascript Code by Taofeekdboy(m): 1:09pm On May 13, 2020
Iamsheye:

Tried this, didn't work so I figured lemme do it another way
I tried it with this and it works perfectly and it's more efficient.

Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 2:20pm On May 13, 2020
SqueezedPant:



what app?
Spck Editor on Android
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 2:33pm On May 13, 2020

Re: Need Someone To Help With My Javascript Code by Taofeekdboy(m): 3:05pm On May 13, 2020
Iamsheye:
Nice
But I don't seem to understand that use of indexOf and the -1 there mind explaining?
I'm still learning just started
when using array in Javascript, it comes with methods in which index, indexOf, search are part of. Index in array means find the number in which the object is located. Example of an array[1, 2, 3, 4],
If you do array.indexof(2) will give you 1 because the item is in the array but if it's not in the array it will give you - 1, searching for something in the array gives you 1 or - 1 depending on if the item is there or not.
You can read more on indexOf, index, search in Javascript Array.
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 4:47pm On May 13, 2020
Taofeekdboy:
when using array in Javascript, it comes with methods in which index, indexOf, search are part of. Index in array means find the number in which the object is located. Example of an array[1, 2, 3, 4],
If you do array.indexof(2) will give you 1 because the item is in the array but if it's not in the array it will give you - 1, searching for something in the array gives you 1 or - 1 depending on if the item is there or not.
You can read more on indexOf, index, search in Javascript Array.
thanks
I get it now
Re: Need Someone To Help With My Javascript Code by nosagold(m): 10:50am On May 14, 2020
Iamsheye:
So I've got that code there..
Everything's fine except that when a wrong input(one that is not in the array) is inserted I want it to show what's on line 16 but it doesn't it's just empty

Can someone please help??

There's a big in your code on line 15. You're using the assignment operator (=). Change it to == or just use if (!check)
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 3:40pm On May 14, 2020
nosagold:


There's a big in your code on line 15. You're using the assignment operator (=). Change it to == or just use if (!check)
Check the thread, I've fixed it already
Re: Need Someone To Help With My Javascript Code by nosagold(m): 4:24pm On May 14, 2020
Iamsheye:
Check the thread, I've fixed it already

Alright bruv

(1) (Reply)

For Beginners Learning To Code / What Can I Make With Python? / Im New N Pleeaasse Need Help On Game Programg Books

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