js range

Array.apply(null, Array(5)).map(function (_, i) {return i;});
=> [0, 1, 2, 3, 4]
[...Array(5).keys()];
=> [0, 1, 2, 3, 4]
String.fromCharCode(..._.range('A'.charCodeAt(0), 'D'.charCodeAt(0) + 1));
=> "ABCD"
    原文作者:starcoding
    原文地址: https://segmentfault.com/a/1190000008587985
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞