+ 1
Yes string concantenation would work, but you need to convert the input to numbers using parseInt() first.
Here is a demo for your version:
https://code.sololearn.com/WfuTBfLSx2vq/?ref=app
For Ipang's array version, you need push() and join()
Here is a demo of Ipang's version:
https://code.sololearn.com/WyXpYf9cbK1R/?ref=app
These simple projects help embrace your JS skill, keep up 💪
P.S. I don't like your current SoloLearn profile name, it is rude and harrassing.
0
Illustrate the inputs and expected output please.
About split(), it is a method that is implemented in string class. But <numq2> is a Number not a string, so it's not possible to split s Number, except where the Number is converted to string first.
0
You still not telling me what expected output should be, given a certain inputs ...
0
I guess you have two options ...
1. Use an array, fill it up with numbers in range, then use string.join() method to glue the elements into a string.
2. Use an empty string, and concatenate each number in range to the string.
There could be another way, these are just what I had in mind ...