Protractor - get browser title as string
<p>I'd like to store initial device title, which is accessible via GUI in browser as page title, and reuse it later in the code. E.g. I want to change name of device if it is set to some particular name only, and to store an old device name in browser console log. Code might look like this:</p>

<pre><code>    var some_name = 'Some Name';
    var title = browser.getTitle();
    console.log(title);
    if (title.equals('Some Name')){
    some_name = 'Some Other Name';
    }
    setDeviceName(some_name);
</code></pre>

<p>unfortunately, to that protractor responds with </p>

<pre><code>    TypeError: title.equals is not a function
</code></pre>

<p>How is it possible to extract browser title as string?
Thanks.</p>

<p><strong>UPDATE:</strong></p>

<p>Thanks everyone, the solution due to igniteram1 is</p>

<pre><code>    var some_name = 'Some Name';
    some_name = browser.getTitle().then(function(webpagetitle){
      if (webpagetitle === 'Some Name'){
        return 'Some Other Name';
      }else{
        return 'Some Name'
      } 
    });
    expect(some_name).toEqual('Some Other Name');
</code></pre>