How many instances of { are there in:
Q: Register Javascript On Master Page in SharePoint Online Add Ins When SharePoint Add in installed I want to add javascript on site master page in which app was installed pro grammatically in Office 365 SharePoint Online.
How to do that dynamically? 

A: It is not possible in SharePoint hosted app because in SharePoint Hosted app, we dont have App installed or uninstalled event receiver.
For SharePoint Hosted app, we need to give one configuration page and on configuration page we need to write below custom code to insert javascript into Site master page.
//provisionScriptLink: method that adds the custom action
    var provisionScriptLink = function () {
        var context;
        var factory;
        var appContextSite;
        var folder;
        context = new SP.ClientContext(decodeURIComponent(getQueryStringParameter(SPAppWebUrl)));
        factory = new SP.ProxyWebRequestExecutorFactory(decodeURIComponent(getQueryStringParameter(SPAppWebUrl)));
        context.set_webRequestExecutorFactory(factory);
        appContextSite = new SP.AppContextSite(context, decodeURIComponent(getQueryStringParameter(SPHostUrl)));



        var actions = appContextSite.get_site().get_userCustomActions();
        context.load(actions);
        context.executeQueryAsync(function () {
            var enumerator = actions.getEnumerator();


            var newAction = actions.add();
            // the description is what well use to uniquely identify our custom action
            newAction.set_description(CustomActionTag);
            newAction.set_location(ScriptLink);
            newAction.set_scriptBlock(inject());
            newAction.set_sequence(1000);
            newAction.update();


            context.executeQueryAsync(function () {
              console.log(successfully added);

            }, function(){
console.log(failed);
}
              );
        }, function(){
console.log(failed);
});
    };


user
The given text has five "{"s.
assistant