v1
- by lamik 12/10/202000
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
let n=10;
delete caserun single casemove downdrag and drop case


ready



function A(N) {
  return Array.from({length: N}, (_, i) => i + 1)
}

A(n);
delete caserun single casemove upmove downdrag and drop case


ready



function B(N) {
  return Array(N).fill().map((_, i) => i+1);
}

B(n);
delete caserun single casemove upmove downdrag and drop case


ready



function C(N) {
  return Array(N).join().split(',').map((_, i) => i+1 );
}

C(n);
delete caserun single casemove upmove downdrag and drop case


ready



function D(N) {
  return Array.from(Array(N), (_, i) => i+1)
}

D(n);
delete caserun single casemove upmove downdrag and drop case


ready



function E(N) {
  return Array.from({ length: N }, (_, i) => i+1)
}

E(n);
delete caserun single casemove upmove downdrag and drop case


ready



function F(N) {
  return Array.from({length:N}, Number.call, i => i + 1)
}

F(n);
delete caserun single casemove upmove downdrag and drop case


ready



function G(N) {
  return (Array(N)+'').split(',').map((_,i)=> i+1)
}

G(n);
delete caserun single casemove upmove downdrag and drop case


ready



function H(N) {
  return [ ...Array(N).keys() ].map( i => i+1);
}

H(n);
delete caserun single casemove upmove downdrag and drop case


ready



function I(N) {
  return [...Array(N).keys()].map(x => x + 1);
}

I(n);
delete caserun single casemove upmove downdrag and drop case


ready



function J(N) {
  return [...Array(N+1).keys()].slice(1)
}

J(n);
delete caserun single casemove upmove downdrag and drop case


ready



function K(N) {
  return [...Array(N).keys()].map(x => ++x);
}

K(n);
delete caserun single casemove upmove downdrag and drop case


ready



function L(N) {
  let arr; (arr=[ ...Array(N+1).keys() ]).shift();
  return arr;
}

L(n);
delete caserun single casemove upmove downdrag and drop case


ready



function M(N) {
  var arr = [];
  var i = 0;

  while (N--) arr.push(++i);

  return arr; 
}

M(n);
delete caserun single casemove upmove downdrag and drop case


ready



function N(N) {
  var a=[],b=N;while(b--)a[b]=b+1;
  return a;
}

N(n);
delete caserun single casemove upmove downdrag and drop case


ready



function O(N) {
  var a=Array(N),b=0;
  while(b<N) a[b++]=b;
  return a;
}

O(n);
delete caserun single casemove upmove downdrag and drop case


ready



function P(N) {
  var foo = [];
  for (var i = 1; i <= N; i++) foo.push(i);
  return foo;
}

P(n);
delete caserun single casemove upmove downdrag and drop case


ready



function Q(N) {
  for(var a=[],b=N;b--;a[b]=b+1);
  return a;
}

Q(n);
delete caserun single casemove upmove downdrag and drop case


ready



function R(N) {
  for(var i,a=[i=0];i<N;a[i++]=i);
  return a;
}

R(n);
delete caserun single casemove upmove downdrag and drop case


ready



function S(N) {
	let foo,x;
	for(foo=[x=N]; x; foo[x-1]=x--);
  return foo;
}

S(n);
delete caserun single casemove upmove downdrag and drop case


ready



function T(N) {
  return new Uint8Array(N).map((item, i) => i + 1);
}

T(n);
delete caserun single casemove upmove downdrag and drop case


ready



function U(N) {
  return '_'.repeat(N).split('').map((_, i) => i + 1);
}

U(n);
delete caserun single casemove upmove downdrag and drop case


ready



function V(N) {
  return _.range(1, N+1);
}

V(n);
delete caserun single casemove upmove downdrag and drop case


ready



function W(N) {
  return [...(function*(){let i=0;while(i<N)yield ++i})()]
}

W(n);
delete caserun single casemove updrag and drop case


ready



function X(N) {
  function sequence(max, step = 1) {
    return {
      [Symbol.iterator]: function* () {
        for (let i = 1; i <= max; i += step) yield i
      }
    }
  }

  return [...sequence(N)];
}

X(n);
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN