Sets in JavaScript

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.

Comments
Post a comment
No comments found.
Post comment:
Format Type: 
  Convert newlines
  Receive comment notifications for this article
Subject: 
   
insert bold tagsinsert italic tagsinsert underline tagsinsert strikethough tagsinsert linkinsert blockquote tags
Comment: 
Comment verification:

Please enter the text you see inside the graphic to post your comment:
You are not currently logged in. If you would like your user information to be displayed with your comment, please enter your login information below.
Login information:
Username: 
Password: 
If you would like to post contact information on your comment, please enter your information into the optional fields below:
Contact information:
Name: 
URL:  example: http://yourdomain.com
Email: 
Please note: email will not be displayed on the site, only for the blog owner. If logged in, URL will only be used.