You can specifiy multiple direcotiesdirectories in grepgrep:
grep -r "string" app/assets/javascripts spec/javascripts
AlternativlyAlternatively - sometimes more usefulluseful is list files to grep by findfind, and then grep them, for example
find app/assets/javascripts spec/javascripts -type f -print0 |xargs|
xargs -0 grep "string"
or
find app/assets/javascripts spec/javascripts -type f -exec grep -H "string" {} \;+