google search for get query params in javascript. it's a well solved problem.  And yeah, just taking the name of the param as the argument is fine.