Skip to content
Advertisement

How would I increment the numerical portion of a specific parameter in a URL string?

Here’s my specific example:

JavaScript

I need the numerical value of param7 in this example to increase by a count of 1 before each pass up to param7 = ’30’.

Is there any way to create a list or dict containing values ‘1’ through ’30’ and tell param7 to use use move through the dict at index + 1?

Advertisement

Answer

You can use a for loop with a range() function which returns a sequence of numbers, starting from first number specified, incrementing by 1 (by default), and stoping before second specified number.

JavaScript
Advertisement