Ryan Aulia

Count by X

# Problem Solving
Create a function with two arguments that will return an array of the first n multiples of x.
Assume both the given number and the number of times to count will be positive numbers greater than 0.
Return the results as an array or list ( depending on language ).
In this JavaScript implementation, we initialize an empty array result. Then, we use a for loop to iterate from 1 to n (inclusive). Inside the loop, we multiply x by the current iteration i and push the result into the result array using the push method. Finally, we return the result array.
For example,
would return
, and
would return
JavaScript Playground