Message from JavaScript discussions

November 2017

— 

function randStr(bits = 16) {
compose((1 + Math.random()) * 0x10000,
Math.floor,
int => int.toString(bits),
str => str.substring(1)
);
}

Message permanent page

— 

function htmlSpecialChars(string) {
return compose(string,
s => s.replace(/&/g, "&"),
s => s.replace(/"/g, """),
s => s.replace(/'/g, "'"),
s => s.replace(/</g, "&lt;"),
s => s.replace(/>/g, "&gt;")
);
}

— 

compose(Math.floor, R.toString, R.slice(1))
((1 + Math.random()) * 0x10000);

— So sexy

— It's... effectively the same thing though

— Yep

— But less syntax

— Mostly just words describing what happens

— I think that makes it very readable

— Mine doesn't make a function, just returns a value

— In a new way

— Hence the function wrapper