How to grab substring before a specified character jQuery or JavaScript
var streetaddress= addy.substr(0, addy.indexOf(','));
While it's not the best place for definitive information on what each method does (mozilla developer network is better for that) w3schools.com is good for introducing you to syntax.
var streetaddress = addy.split(',')[0];
try this:
streetaddress.substring(0, streetaddress.indexOf(','));