Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,980 members, 7,956,660 topics. Date: Monday, 23 September 2024 at 04:27 PM |
Nairaland Forum / Science/Technology / Programming / Need Someone To Help With My Javascript Code (1292 Views)
I Want To Add A Backend Tech To My Javascript Knowledge. Java, PHP Or Python? / How Can I Run Javascript Code On Vs Code / Please Help With This Javascript Code (2) (3) (4)
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: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: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: 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:Bro thanks it worked Can't believe it's cos of one thing I wan run mad before |
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 6:52pm On May 12, 2020 |
codeigniter: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 , 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 , 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: 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:Guy I've gotten there I just dropped it to one side How will I be seeing something like /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\" Am I mad 1 Like |
Re: Need Someone To Help With My Javascript Code by Iamsheye(m): 10:15pm On May 12, 2020 |
crunchyDope: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: 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 Turns out I did not farabale,my blood was hot
|
Re: Need Someone To Help With My Javascript Code by Taofeekdboy(m): 8:45am On May 13, 2020 |
Iamsheye: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: 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: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: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 |
Re: Need Someone To Help With My Javascript Code by Taofeekdboy(m): 1:09pm On May 13, 2020 |
Iamsheye: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: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: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:thanks I get it now |
Re: Need Someone To Help With My Javascript Code by nosagold(m): 10:50am On May 14, 2020 |
Iamsheye: 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: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: Alright bruv |
(1) (Reply)
Visual Basic Expert Please Save A Soul / Artificial Intelligence / I Am Looking For A Java Developer
(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. 29 |