Making a small Library in Solidity
Hello guys, hope you all are doing great!!! π.
Blockchain is quite popular these days. I mean it is the frenzy on the net especially with the upsurge of Bitcoin's value. Following the trend, I would be writing the greatest article of all time. π. ...
swacblooms.hashnode.dev9 min read
So this line really stood out. πππ
You did a good job to make light of the topic. For the getPositiveAndSquare function, you can actually substitute a pipe of filter and map into a single reduce.
const getPositiveAndSquare = arr => { return arr.reduce((acc, cur) => { if (cur > 0) { acc.push(cur * cur); } return acc; }, []); }; console.log(getPositiveAndSquare([2, 3, 4, 0, 2]));Though I have no idea of the solidity you talked about. π