i have stumbled upon unexpected behavior in javascript
'use strict'; var _ = require('lodash'); _.map([1, 2, 3], function(x){console.log(x); }); _.map([1, 2, 3], console.log); the 2 calls map behaving differently.
the first printing 1, 2, 3 line line, whereas latter call map prints iterator map yields.
is there more elegant way write first call? (without using es6 => operator)
you can use ary limit number of arguments passed console.log.
_.map([1, 2, 3], _.ary(console.log, 1))
Comments
Post a Comment