3 ms·
You mean like JavaScript? Not sure why it's not listed there next to Pike. var f = [] f['push'](2) // f -> [2] Pike also has the more familiar obj
by ajanuary 14y ago
You mean like JavaScript? Not sure why it's not listed there next to Pike.
var f = []
f['push'](2)
// f -> [2]
Pike also has the more familiar object->method(params) syntax.
It's actually a pretty useful bit of syntax. I've been using it recently when combining multiple objects deserialised from json.
var report = [name, dob]
var person = { name: 'Andrew', dob: '1980/03/23' }
_.each(report, function(prop) {
console.log(person[prop])
}
- wilmoore 14y agoGood call...and for those not necessarily using something underscore.js-like (thought almost always nice-to-have): var report = ['name', 'dob']; var person = { name: 'Andrew', dob: '1980/03/23' }; report.forEach(function(prop){ console.log(person[prop]); });