Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Revisions

2 of 2
deleted 3 characters in body
m.antkowicz
  • 13.7k
  • 22
  • 43

it is not very good idea but if you really need to create variables on-the-run here's the code:

for (i = 0; i < feeds.length; i++) 
{
 var feed = feeds[i];
 window[feed.substring(0, feed.indexOf(":"))] = feed.match(/\d+$/);
}
alert(test_user_201508_20150826080829)

Of course you cannot have any variable-name-string containing banned signs (like '.')

Regards, Michał

m.antkowicz
  • 13.7k
  • 22
  • 43

AltStyle によって変換されたページ (->オリジナル) /