I'm trying to create an array dynamically by getting user input. range comes as a parameter. When I try to console.log() that it logs the correct value of range, but when I try to use it in const a=Array(...Array(range).keys()); it doesn't take range as correct parameter. When I hard code a number instead of range it gives a correct array. What would be the problem here??
import React from 'react';
import { Button, TextField } from '@material-ui/core';
import { useState } from 'react';
export default function handleSumOfMultipliers(multiplier, range) {
console.log("range" + range)
const a = Array(...Array(range).keys());
console.log(a);
return (
<div></div>
);
};
const a=Array(...Array(range).keys());toconst a=Array(...Array(parseInt(range)).keys());