Bash String Substitution Javascript Interview