M' boss, Bart, asked a nifty interview question to a potential candidate that I found intriguing: "Gimme a function that determines a string's length without the use of local variables" He explained it to me and I spruced it up to parse a paragraph of text:
function f(s) {
return (s.length>0)?(((null===s.charAt(0).match(/\S/))?0:1)+f(s.substring(1))):0;
}
Neat.Labels: programming