Discuss / JavaScript / 作业

作业

Topic source

Mason

#1 Created at ... [Delete] [Delete and Lock User]

1.  product

return arr.reduce((x, y) => x * y, 1);

2. string2int

return s.split("").map(x => +x).reduce((x, y) => x * 10 + y);

3. normalize

return  arr.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase());

r = arr.map((x) => parseInt(x, 10));


  • 1

Reply