Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So while learning javascript, I decided to make a silly script that would ask the user, how many tabs they wanted to open, and would then create that many tabs. The problem is when I try making it a bookmark on google chrome with the javascript: header, the code no longer works.

What I have tried:

I tried the code on www.jsconsole.com as well as https://repl.it/repls and it worked on both, so I don't know what I'm doing wrong. I tried executing the code without the do loop, and just opening one tab, and it worked just fine. So I have no idea what;s wrong. Here's the code...
JavaScript
var count = 0;

var tabAmount = prompt("How many tabs would you like to open?");

do {
  window.open()
  count = count + 1;
}
while (count < tabAmount);


I'm seriously confused so any explanation as to why it doesn't work would be great.
Posted
Updated 27-May-18 18:49pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900