Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 317 Bytes

unary.md

File metadata and controls

16 lines (12 loc) · 317 Bytes
title tags
unary
function,beginner

Creates a function that accepts up to one argument, ignoring any additional arguments.

  • Call the provided function, fn, with just the first argument given.
const unary = fn => val => fn(val);
['6', '8', '10'].map(unary(parseInt)); // [6, 8, 10]