Assuming you are using a recent version of Protractor, let's say >= 1.1.0, hopefully >= 1.3.1
Attempting to access Browser side JS code directly from protractor will not work as a result of protractor runs in NodeJS and each Browser side code is executed through selenium JsonWireProtocol.
A working example is shown below:
browser.get('https://angularjs.org/');
One-liner promise that, as of today, resolves to '1.3.0-rc.3' browser.executeScript('return window.angular.version.full;');
You can use it directly in an expect statement given Protractors expect resolves promises for you:
expect(browser.executeScript('return window.angular.version.full;'))
toEqual('1.3.0-rc.3');
Longer example passing a function instead of a string and while not expected to resolve the promise for you. i.e.for additional control and for doing a little fancy thing with the result.
browser.driver.executeScript(function() ).then(function(result) );