Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

a func called count and this func accepts 2 parameters and it'll return a string.If count(0,5).output: 0,1,2,3,4,5.I only slove this prblm in array

function count(param1, param2) {
  let value = [];
  for (let i = param1; i <= param2; i++) {
    value.push(i);
  }
  return value;
}
let countNumber = count(0, 10);
console.log(countNumber);

I want to show it as a string like 0,1,2,3,4,5. But I can’t solve this problem. I can only solve this as an array. My output is [0,1,2,3,4,5].

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

try

console.log(countNumber.toString());

ref : https://www.w3schools.com/jsref/jsref_tostring_array.asp

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading