switch(!0) What does it mean

Viewed 1012

I saw a piece of code that stuck me as odd. What does switch(!0) mean in javascript? What are some cases where this technique would be useful to use?

jsTree uses it in a few places but it looks foreign. I'm sure it has a good reason behind it, but can't figure it out.

http://www.jstree.com/

Here is a clip of code:

switch(!0) {
    case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
    case ($.isFunction(s.data)): //...
                                 break;
}
2 Answers
Related