Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // the agility of javascript's ternary operation...
- // lots of folks don't seem aware of the subsequent assignments available
- function ternary(a,b) {
- var c,d,tis='';
- c = (d = a==b) ? tis='tis true' : tis='tis false';
- return [c,d,tis];
- }
- console.log(ternary(true,true));
- console.log(ternary(true,false));
- console.log(ternary(false,false));
Add Comment
Please, Sign In to add comment