js:
var data = [ {fname: 'Roy', lname: 'Red'}, {fname: 'Gary', lname: 'Green'}, {fname: 'Bob', lname: 'Blue'}, ]; var dataUpd = R.pipe( R.reverse, R.take(2), //R.takeLast(2), )(data); alert( JSON.stringify(dataUpd) );
Result:
js:
var data = [ {fname: 'Roy', lname: 'Red'}, {fname: 'Gary', lname: 'Green'}, {fname: 'Bob', lname: 'Blue'}, ]; var dataUpd = R.pipe( R.reverse, R.take(2), //R.takeLast(2), )(data); alert( JSON.stringify(dataUpd) );
Result: