tag:blogger.com,1999:blog-3803541356848955053.post5679356553858400656..comments2016-05-06T18:44:33.019-07:00Comments on YJL: Boolean in JavaScriptYu-Jie Linhttps://plus.google.com/115422682039760465813[email protected]Blogger2125tag:blogger.com,1999:blog-3803541356848955053.post-62742487563422542592012-02-03T17:14:54.138-08:002012-02-03T17:14:54.138-08:00I kind of agree with you since I can't find an...I kind of agree with you since I can't find any case for using Boolean other than the Boolean primitive values.<br /><br />I wrote this post because I was reading some jQuery plugin code, IIRC. And it has a callback function in its options, which returns true/false for indication certain action.<br /><br />Since it's a function, you will need to supply a function in order to return true/false because it has to be invoked. It's inconvenient if it's true or false in all cases.<br /><br />Even though I don't use that plugin, just happen to read its code and it got me an idea. So, I was trying to see if I can make primitive value true/false to be callable, e.g. `true()`. The answer is no, but I stumbled upon Boolean on MDN. It brought me back to this again, which I was aware of and I decided I can write a little about this.livibetter[email protected]tag:blogger.com,1999:blog-3803541356848955053.post-33979535849370322112012-02-03T16:44:22.189-08:002012-02-03T16:44:22.189-08:00Boolean should never be used, i guess.
"!!&q...Boolean should never be used, i guess.<br /><br />"!!" is your friend if you need a quick conversion from anything to boolean.^^Nicolas Fritz[email protected]