- Jun 8, 2005
- 9,673
- 583
- 126
Right now we are taking a full course on C#. No big deal we're doing just fine there.
But on the Web Programming side, we're doing a chapter on javascript.. And nothing here is making sense.
We need some help understanding this. So we're asking for homework help. If you're willing to help, please explain some of the syntax behind this. We're trying, and have went about 7 hours today on it, but its just not really clicking for us. I'm sure eventually it will, but I think we need more help then just a chapter in a book.
Question 1:
Parameter is an array of names, represented as strings.
We need to return the number of names in the array that end in either "ie" or "y".
So first we made an array:
Next we sorted it out into one long string:
I'm guessing what we need to do now is run a search on it to the effect of:
then i'm guessing its something like:
Then finish with:
I really feel like its not that simple. And it's not since its not running. But the suggestions here to be very simple. This is my first few days in javascript and obviously I know nothing advanced of the language. I just need to know whats gone wrong and what i have to do to make it right. The book isn't helping much. As seen by bro's post today, our book didn't even tell us what an alert box is limited to.
anyone wanna give a hand?
But on the Web Programming side, we're doing a chapter on javascript.. And nothing here is making sense.
We need some help understanding this. So we're asking for homework help. If you're willing to help, please explain some of the syntax behind this. We're trying, and have went about 7 hours today on it, but its just not really clicking for us. I'm sure eventually it will, but I think we need more help then just a chapter in a book.
Question 1:
Parameter is an array of names, represented as strings.
We need to return the number of names in the array that end in either "ie" or "y".
So first we made an array:
var namesArray = new Array("Taffy", "Mary", "Daphnie",
"Todd", "Barbie", "Carl");
Next we sorted it out into one long string:
var name_string = namesArray.sort();
I'm guessing what we need to do now is run a search on it to the effect of:
name_string.search("y$"||OR"ie$")
then i'm guessing its something like:
var sum=0,
count;
for (count =0; count > -1; count++)
sum += count;
Then finish with:
document.write("There are ", + sum + "names ending in ie or y");
I really feel like its not that simple. And it's not since its not running. But the suggestions here to be very simple. This is my first few days in javascript and obviously I know nothing advanced of the language. I just need to know whats gone wrong and what i have to do to make it right. The book isn't helping much. As seen by bro's post today, our book didn't even tell us what an alert box is limited to.
anyone wanna give a hand?
