javascript question on my assingment , what would you ever need to do this for?

NAMEWITHELD12
NAMEWITHELD12 used Ask the Experts™
on
I have an assignment that requirers the steps below , but I cannot visualize why you would need a webpage form with these things that are required ,

I am very very very new to Javascript !!

thanks so much for any guidence you can give me !!!!!!!!



Create an HTML form.
Create and Initialize three arrays.
Use for-loops to populate those arrays.
Add an element to the end of one array.
Remove an element from the end of another array.
Add a new element to the beginning of one array.
Add at least one additional array method of your choice.
Convert an array to a string.
Use the converted string, assign to a string variable, and use it to populate a form field.
Create different functions to handle the operations of steps 4, 5, 6, and 7. (You can create additional array methods.)
Create four or more buttons on the form with different event handlers to start the above functions upon clicking them.
Create an additional button with an event handler to complete the operation in step 10.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
JavaScript handling of form data is a common thing to do.  I would say that if you didn't 'interface' with forms, you would have ignored many of the important things that JavaScript is used for.  I use JavaScript on virtually every one of the hundreds of form page I have written in the last 8 or 10 years.

Author

Commented:
I'm having trouble visualizing how three arrays pre-populated with a for-loop (assuming this really only works with numbers?) would be useful when filling out a form, though....I'm sorry if I seem a little dense on this, but I'm really drawing a blank.  I feel like if I had a real world (but easy for a beginner to implement) example of why these steps would need to be done it would make the instructions a little less mystifying....
Moussa MokhtariEnterpreneur
Top Expert 2016

Commented:
Hi NAMEWITHELD12 it's good thing to question about questions (Why /for what/ how)but some times assignments  are just assignments no big goal from it just making you use your brain in non logical way
just work with the flow and answer every question step by step and remember that not every question have have a purpose from it.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

RobOwner (Aidellio)
Most Valuable Expert 2015

Commented:
Sounds like a convoluted exercise to help you understand how arrays can be used.
What comes to mind is that you can pass data to JavaScript from a server, and that data is often in  JSON (JavaScript Object Notation) format. They can contain arrays that you may want to display and in this case let the user edit it via a form.

Author

Commented:
No server in this scenario is available, unfortunately.  I totally agree, I definitely don't want to psychoanalyze the prof at this point and figure out why these steps are all in one assignment, I think I'd just rage quit the assignment if I did :-)  I neglected to mention that at the start of the steps, it tells you the HTML page you build from scratch can be a theme of your own choosing.  I, for the life of me, can't think of a theme, so I can't visualize how to implement any of the steps.

i.e.  It's an HTML form.  A user enters first name, last name, maybe they're filling out a job application or something.  The javascript populates three arrays with for-loops that contain, I assume, only random numbers because for-loops can't populate an array with anything else (right?) What would the user use these arrays for?  A drop-down list?  A.....??
Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:
Since the 'theme' has nothing to do with the assignment, I would make the page as simple as possible.

A for-loop can use any data that is available.  Frequently the 'for' counter is used as part of the data like "sam1, sam2, sam3".  A drop-down (options for a select statement) is another good choice.
Owner (Aidellio)
Most Valuable Expert 2015
Commented:
If you're looking for themes, it's extra work but bootstrap will give you an advantage http://getbootstrap.com
I like Dave's suggestion to keep it simple but if there's a requirement to theme your work then bootstrap could make it easier (or harder) depending on your understanding of css and classes. If you have no idea what I just said then stick with basic css to format your page and form. Here's a good as any tutorial on css http://www.w3schools.com/css/
RobOwner (Aidellio)
Most Valuable Expert 2015
Commented:
As for the arrays, they can be represented in many ways. For this exercise, I would populate those arrays with meaningful data e.g. Countries, states, gender, Marital status etc
Then try using checkboxes, radio groups, dropdowns for those arrays and see what makes the most sense and is user-friendly.

Author

Commented:
I got some great ideas for how to use a for-loop to populate the array.  Now to start on the code! Thanks everyone!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial