I can't figure this out | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

18th Mar 2018, 3:16 AM
jacksonofgames 28
jacksonofgames 28 - avatar
28 Answers
+ 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.
18th Mar 2018, 8:47 AM
David Carroll
David Carroll - avatar
+ 6
Are you seeing that in my version as well?
18th Mar 2018, 10:06 PM
David Carroll
David Carroll - avatar
+ 6
What's the expected points? My version shows 11 pts.
19th Mar 2018, 5:44 AM
David Carroll
David Carroll - avatar
+ 6
I'll have a look tomorrow.
20th Mar 2018, 2:51 AM
David Carroll
David Carroll - avatar
+ 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.
20th Mar 2018, 8:44 PM
David Carroll
David Carroll - avatar
+ 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.
23rd Mar 2018, 1:30 AM
David Carroll
David Carroll - avatar
+ 5
What words should I test with to get the same results?
18th Mar 2018, 11:34 PM
David Carroll
David Carroll - avatar
+ 5
That's what I thought. I'm getting 8 for hello.
20th Mar 2018, 2:11 AM
David Carroll
David Carroll - avatar
+ 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
20th Mar 2018, 2:17 AM
David Carroll
David Carroll - avatar
+ 5
Did you follow all my notes in the code?
20th Mar 2018, 2:23 AM
David Carroll
David Carroll - avatar
+ 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
24th Mar 2018, 3:07 AM
David Carroll
David Carroll - avatar
+ 4
I'm actually available to review this in a couple of hours. I can get this working if I get a few minutes. 😉
22nd Mar 2018, 10:00 PM
David Carroll
David Carroll - avatar
+ 2
hi everyone am new here, and i really enjoyed the little time have spent here. I hope to have more fun than expected..
20th Mar 2018, 7:24 AM
Sam
Sam - avatar
+ 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!
18th Mar 2018, 7:14 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
@David Carroll I have fixed the problem to where the first word is correct, but multiple words are a problem
20th Mar 2018, 8:28 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
Sure thing. Thank you for all your help
20th Mar 2018, 8:45 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
That's okay take your time. I'm in no rush
23rd Mar 2018, 2:29 AM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
Thanks for all your help!
25th Mar 2018, 10:50 PM
jacksonofgames 28
jacksonofgames 28 - avatar
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.
18th Mar 2018, 8:12 AM
Jonas Schröter
Jonas Schröter - avatar
0
Yes, yours is not as crazy, but it still doesnt make sense. Idk why
18th Mar 2018, 10:11 PM
jacksonofgames 28
jacksonofgames 28 - avatar