Solved

How to create javascript class and store input values in memory?

Posted on 2014-01-09
3
319 Views
Last Modified: 2014-01-16
How can I create a class Person, with the fields firstname, lastname, age and zipcode. I need to store a large collection of these Person objects in memory. I need to be able to add and delete items, in addition to being able to sort and search by any of the fields.  How can use  Javascript to demonstrate how you would accomplish this.
Can you please describe a memory and performance efficient data structure and mechanism to accomplish this.
0
Comment
Question by:RajG1978
3 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
This sounds like homework and we are not allowed to answer these types of questions.  If you can present us with some code we can help point you in the right direction.
0
 
LVL 9

Accepted Solution

by:
Sar1973 earned 250 total points
Comment Utility
You could create an array with 4 columns/fields, and use the push and the remove methods to add and delete items. See http://www.w3schools.com/js/js_obj_array.asp
0
 
LVL 42

Assisted Solution

by:Rob Jurd, EE MVE
Rob Jurd, EE MVE earned 250 total points
Comment Utility
Please have a read of this article http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_12264-Javascript-Frameworks-what-are-they.html
It outlines a basic framework but also the basics of class creation and instantiation
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now