just some code snippets that I tried when refining my concept of javascript FP.
1 2 3 4 5 6 7
| var funcList = [ function () { console.log('1...') }, function () { console.log('2...') }, function () { console.log('3...') } ] funcList.forEach((f) => f());
|
玩一下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| String.prototype.toNumber = function () { return +this; }; var contactList = [{ name: "Jonny", gender: "M", occupation: "Artist", age: 30, }, { name: "Nita", gender: "F", occupation: "Model", age: "27", }, ]; console.log(contactList[1].age.toNumber());
|