+ 1
I can't figure this out
I'm trying to make it so that the page outputs each word and how many points it would score in scrabble, but the value of all the words are 1 and so is the value of letterCounter when you document.write() it. Any help at all is greatly appreciated https://code.sololearn.com/W8ohHMjCeU7s/?ref=app
28 odpowiedzi
+ 6
@jacksonofgames... There were quite a few issues with this code. Short of rewriting and reorganizing the code, I applied some minor adjustments to get this working for you.
See the code comments in my version where I prefixed each comment as follows:
//DC: [followed by notes...]
I'm pretty busy with some other development projects at the moment and may not be able to keep helping with this. Hopefully, this will cover a lot of what you need.
- https://code.sololearn.com/WBnqu9kPuAA7/#js
BTW: I had a hard time following the meaning of your variables. It helps to avoid using abbreviations.
+ 6
Are you seeing that in my version as well?
+ 6
What's the expected points? My version shows 11 pts.
+ 6
I'll have a look tomorrow.
+ 6
@Jacksonofgames... Great! I'm so sorry for not getting back to this. I'm juggling quite a bit at the moment.
I have an idea about the multiple words split up. I'll try to post an update later. Let me know if you get to it before me.
+ 6
It may not be until tomorrow now. My kids needed a lot more help studying for math and other tests than I realized. I'll let you know if I look at this tonight.
+ 5
What words should I test with to get the same results?
+ 5
That's what I thought. I'm getting 8 for hello.
+ 5
LOL... I literally thought you were testing with "hello sir". That's what I used when I got 11.
Your response to my question was:
> Hello sir is what I've been doing
+ 5
Did you follow all my notes in the code?
+ 5
Hi Jackson... I just now had a chance to take a look.
The fix was simple. Look at line 59 in my code. Also, notice the nested for loop now on line 63. Finally, lines 105 through 107 were moved into the first loop.
https://code.sololearn.com/WBnqu9kPuAA7/?ref=app
+ 4
I'm actually available to review this in a couple of hours. I can get this working if I get a few minutes. 😉
+ 2
hi everyone am new here, and i really enjoyed the little time have spent here. I hope to have more fun than expected..
+ 1
I have done that now, thank you. I had that initially but thought I didn't need it at some point, but I brought it back now. My only problem now is with letterCounter. If you print out its value afyer the innermost loop runs, its some crazy number, and I have no idea how it gets that. P.S. thank you @David Carroll so much!
+ 1
@David Carroll I have fixed the problem to where the first word is correct, but multiple words are a problem
+ 1
Sure thing. Thank you for all your help
+ 1
That's okay take your time. I'm in no rush
+ 1
Thanks for all your help!
0
I'm not sure, but your letters array is a two dimensional array isn't it? But to iterate through it, you've just one loop. So you get an array of letter what you compare to single letters.
0
Yes, yours is not as crazy, but it still doesnt make sense. Idk why