JavaScript interview Question - Create a Array with two papameters without using loop!
JavaScript interview Question - Create a Array with two papameters without using loop!
JavaScript - 不用循环, 创建数组 & 数据
https://stackoverflow.com/a/44206718/5934465
JavaScript问题:
自定义一个函数,接收 m,n 两个整数参数,
返回一个长度为m 的且值都等于n的数组,
不能使用任何js 的循环语句 (for, for in, for of , forEach, while, do while)!
const createNoLoopArray = (m, n) => new Array(m+1).join(n).split('').map((value) => parseInt(value, 10));
console.log(`%c createNoLoopArray(7, 3) = ${createNoLoopArray(7, 3)}`, `color: #f0f`);
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration
https://www.tutorialspoint.com/javascript/javascript_for_loop.htm
JavaScript中提供了这些循环语句:
for statement
do...while statement
while statement
label statement
break statement
continue statement
for...in statement
for...of statement
https://zhuanlan.zhihu.com/p/27134194
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/6911118.html
未经授权禁止转载,违者必究!