Splits a string into an Array, treating all whitespace as delimiters. Equivalent to Ruby's %w{foo bar} or Perl's qw(foo bar).
This can slightly shorten code when writing simple iterations:
This also becomes sweet when combined with Element functions:
1 $w('apples bananas kiwis')
2 // -> ['apples', 'bananas', 'kiwis']
2 // -> ['apples', 'bananas', 'kiwis']
This can slightly shorten code when writing simple iterations:
1 $w('apples bananas kiwis').each(function(fruit){
2
3 var message = 'I like ' + fruit
4
5 // do something with the message
6
7 })
2
3 var message = 'I like ' + fruit
4
5 // do something with the message
6
7 })
This also becomes sweet when combined with Element functions:
1 $w('ads navbar funkyLinks').each(Element.hide);
浙公网安备 33010602011771号