Include in a variable url conunt javascript 'console' Chrome

Asked

Viewed 24 times

-2

var account = 1 var account = 1 + 1

window.open('/test/number/11965/', '_Blank')

I need to replace the value of 11965

by variable account so that it remains

window.open('/test/number/COUNT/', '_Blank')

window.open('/test/number/1/', '_Blank') window.open('/test/number/2/', '_Blank') window.open('/test/number/3/', '_Blank')

if you have how to put inside a loop or count 1 to 100000

kindly

thanks.

1 answer

0


First, the string you want is a template string, using ` instead of '

ex: window.open(/teste/numero/${suaVariavel}/, '_Blank')

the loop would then look like this:

for (var i = 1; i <= 100000; i++) {
  window.open(`/teste/numero/${suaVariavel}/`, '_blank')
  suaVariavel++
}

Only replace your real name

  • Esther Maia, thank you running grateful perfect....

Browser other questions tagged

You are not signed in. Login or sign up in order to post.