A common task in programming is determining if a value is equal to one of a set of given values. Normally, this might involve setting up a large if or switch structure or a long expression full of Boolean ORs. However, in a flexible language like JavaScript, a simple function lets you implement sets, and testing for set membership is easy. For more, see this article: Sets in JavaScript.
Sets in JavaScript
|
|
Posted by: | Joey deVilla on Tuesday, September 26, 2006 at 11:32 AM EDT |
| Filed under: | Joey deVilla, Programming | |
| Keywords: | JavaScript | |
| Attachments: | None |